LEFT JOIN profiles USING (some_id)
LEFT JOIN prefs USING (some_id)
LEFT JOIN avatars ON profiles.avatar_id=avatars.avatar_id
LEFT JOIN groups ON profiles.group_id=groups.group_id
LEFT JOIN tmpl ON prefs.tmpl_id=tmpl.tmpl_id
I would like to add another clause to the query to count the number of rows from another table given certain conditions. On it's own, that new query looks like this:
SELECT COUNT(*) FROM message where username=sender
How do I append that to the group of LEFT JOINs query above? The COUNT(*) should only apply to the query on the 'message' table and not only the other tables.
There 'ya go... why be "clever?" Just run two queries. If you need more, write a few more queries that work with the output from that. It's really easy to write a "write-only query," if you know what I mean.