I've created a file-uploader for attachments that AJAX uploads them the moment they are added to an email. I have a page where all email attachments are displayed. However should a user decide not to save the email as a draft and also not send it their attachments are still in the database.
I want to still display non-associated attachments (that have no email id association and thus will not JOIN
with the messages table) on the attachments page.
Here is my current query...
SELECT em.date, em.headers_from, em.subject, ea.filename
FROM email_attachments AS ea
LEFT JOIN email_messages AS em ON em.id=ea.id_email
WHERE em.id_user='1'
ORDER BY date DESC