I have a photos table, with two columns in that table named "id" and "user_id". Obviously one user can have many photos. I'd like to run a query that can give me the photo count for each user.
Any help is appreciated.
I have a photos table, with two columns in that table named "id" and "user_id". Obviously one user can have many photos. I'd like to run a query that can give me the photo count for each user.
Any help is appreciated.
select user_id, count(*) as photo_count from photos group by user_id
Use:
SELECT t.user_id,
COUNT(*) AS photo_count
FROM PHOTOS
GROUP BY t.user_id