mysql - Subquery or INNER JOIN? -
I have 3 tables that represent emails like attachments, accordingly, there are zero, one or more attachments in the email .
Three tables I get a result in mysql I am trying to list the email ID and the total size of all the files and no success. I files using Should it use multiple Manipulation in PHP seems ridiculously expensive. Many thanks! email ,
attachments and
files .
Email - Each email is mentioned in an email and has a message id
attachment - each line There can be a message ID and a file ID with multiple lines with the same message ID.
files - Each file is referenced in a file and it has fileID and file size (size) in it
SUM (size) and a
INNER JOIN I can get a total size, but I do not have an e-mail ID and a list of total file size Can writing.
INNER JOIN S?
INNER JOIN and a subquery? And then a
group B ? Subquery and then a
IN even one direction would be really useful.