I'm trying to count all messages sent by users AFTER they uploaded a photo.
I'm trying something like this.
select messages.created_at, count(*) as count from messages
inner join users on messages.user_id = users.id
inner join photos on photos.user_id = users.id
where
some_users_messages.created_at > some_users_first_photo.created_at
group by YEARWEEK(messages.created_at)
I'm thinking this needs to be a subquery? I'm not sure how to do this concept of one particular user's messages/photos in MySQL. Any ideas?
Thanks!