Jump to content

sql question


mojito

Recommended Posts

I would like to understand the syntax used here as i want to access after the field in the table called thumbname

[code]select a.aid as AlbumID, a.Title as Title, a.pid as PictureID, p.thumbname as Picture, count(l.pid) as Cnt from albums a, pictures p, pictures l where a.aid = p.aid and a.pid = p.pid and a.aid = l.aid group by a.aid order by a.aid[/code]

what is the "as" bit doing?
im trying to loop through thus...
while($album = mysql_fetch_array($mysql)) {
echo $album[thumbname];

thanks

[img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

Link to comment
Share on other sites

Thanks ober, thats really useful, but

I can see that "a" is later said to be album and "p" is said to be pictures but the bit I also dont get is the "l" or "1" here..

[code]pictures l where a.aid = p.aid and a.pid = p.pid and a.aid = l.aid group by a.aid[/code]

thanks for sharing your knowledge with us. [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.