album names with photo count sql query!!!
Posted: Thu Aug 23, 2007 2:44 pm
pickle | Please use
But its not returning all sets created by this user. This user has total 4 albums in my samle records, but returning only one. Can you tell me what I am missing or is there any mistake?
Pls help me out. Thanks in advance for your help.
pickle | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too. I'll let you edit your other posts.[/color]
Hello Gurus
I am trying to develop a photo gallery website with php4 and mysql 4(xaampp). Now I have a album table(id, name, desc, created by) and then photos table(id, name, desc,album_id...). Now I want to write a sql query so that i get the following fields:
album id
album name
photo count
where created by a particulaer user id
for that i have used the following query
[syntax="sql"]SELECT pg_albm_id , pg_albm_title,count(pg_photo_id)
FROM pg_photo_albums
LEFT OUTER JOIN pg_photos ON pg_photo_albums.`pg_albm_id` = pg_photos.`pg_photo_albumid`
WHERE t1.`pg_albm_createdby`='kunalm'
GROUP BY pg_photos.`pg_photo_id`Pls help me out. Thanks in advance for your help.
pickle | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too. I'll let you edit your other posts.[/color]