Use sql to find existing attachments.