Hi,
I need some help understanding subqueries. I've tried reading general documentation but it's not really helping. The best way I think I'll understand is by seeing the code for what I need a subquery.
So,
I want to display the number of users that have posted more than X photos in the past X days.
The related tables with their relevant fields for this are users (id) and photos (id, user_id, created_at etc).
Another subquery I'd need is to count all photos with more than X tags. tags and users are linked by a taggings table.
The related tables of the db for this subquery would be users (id), tags (id), taggings (photo_id, tag_id).
I'm used to doing queries with the sprintf function, using mysql_real_escape_string, so I'd best understand if these were used in the explanation.
Any help would be appreciated, thanks in advance!