When I send the following query to Zotero using Zotero.DB.queryAsync, I get a null returned (which I assume means "no results"), but when I run it from the command line using sqlite3 against the DB (after Zotero was stopped of course), I do get results. Any ideas?
WITH duplicates AS ( SELECT parentItemID, contentType,
COUNT(*) as duplicates FROM itemAttachments WHERE
linkMode <> 3 AND itemID NOT IN (select itemID from deletedItems)
GROUP BY parentItemID, contentType ) SELECT
item.itemID, attachment.path, COALESCE(duplicates.duplicates, 1) as
duplicates FROM items item LEFT JOIN itemAttachments
attachment ON attachment.itemID = item.itemID LEFT JOIN
duplicates on attachment.parentItemID = duplicates.parentItemID AND
attachment.contentType = duplicates.contentType WHERE
item.itemTypeID = 14 AND item.itemID NOT IN
(select itemID from deletedItems) AND (
attachment.path IS NULL OR
(attachment.linkMode IS NOT NULL AND attachment.linkMode <> 3)
)