[thelist] [mysql] count query

kris burford kris at midtempo.net
Thu Sep 11 08:49:34 CDT 2003


hello

i've got two tables, one containing image information with an id for which 
folder they appear in, the other the folder data

i've what i thought of as a simple request to get a list of the folders 
ordered by the number of images they contain and including those folders 
which contain no images at all.

my sql query as it stands is:

select f.folder, f.id, count(i.id) as count from folders f left join images 
i on f.id = i.folder_id where f.auth_user = '$auth_user' order by count

but it doesn't want to play ball.

could someone please let me know what i'm doing wrong?

thanks

kris



More information about the thelist mailing list