Log in

View Full Version : mysql help please


loneranger
08-05-2005, 05:47 PM
hi i need some help using a mysql select statement what i have is a table similar to below
userid || username || imagename

now each time a user uploads an image there is a new row created what i want to be able to do is get the amount of images uploaded by each user. i thought maybe using count(*) but i could get this to work how i wanted do any1 have any ideas please???

Marco van Herwaarden
08-05-2005, 06:46 PM
SELECT COUNT(*) from TABLENAME WHERE userid = <userid>

loneranger
08-06-2005, 10:22 AM
yes that will tell me how many images that user has but what about all users is there an easy way with out doing 100's of queries

Marco van Herwaarden
08-06-2005, 11:02 AM
select username, count(*) from user group by username