Jump to content

MySQL COUNT


brianbehrens

Recommended Posts

I'm a little unclear exactly how to use this, or if I can even use thing in conjunction with pulling out the proper amount of data needed.

 

Here's my current query

 

$sql = "SELECT * FROM photo_albums pa LEFT JOIN 
photos p ON pa.pa_id = p.album_id  ORDER BY pa.pa_id DESC";

 

I want to pull out all of my albums and in turn find out all the associated photos with that album.  I'm interested in finding out how many photos are in each album.  I can do it in PHP based on the current query, but after doing some reading it seems I could do this in mySQL.  I'm just unclear if it can be done in the same query or if it would take another one all together?

 

Thank you.

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.