I'm trying to find pages in AEM 6.1 that reference images from the DAM that are wider than 1280px. I'm really struggling to figure out if this is possible via a single JCR_SQL2 query or not. I've tried many things that have not worked (get ParseException when trying to query from CRXDE), but I think the following somewhat conveys what I'm after, except I think I'd need some additional joins, starting at cq:Page, to get pages instead of the actual image component nodes:
SELECT s.* from [nt:unstructured] as s
INNER JOIN [dam:Asset] as a on ISSAMENODE(a, s.[fileReference])
WHERE a.[jcr:content/metadata/tiff:ImageWidth] >= 1280
I've tried joining on jcr:path equality as well, but I can't get anything to actually run.