Jump to content

Pulling artists


ccrevcypsys

Recommended Posts

I need to pull info on all the artists on my site. But along with doing that i need to count how many songs and how many albums that they have. Here is the code that i have now

$productListQuery = "SELECT i.album_id,i.customer_id,i.productId,ar.*,c.*,a.artist_id,
					 COUNT(i.album_id) AS album_count, COUNT(i.productId) AS song_count
					 FROM ".$glob['dbprefix']."artist ar
				         LEFT JOIN ".$glob['dbprefix']."albums a
				         ON ar.customer_id = a.artist_id
				         LEFT JOIN ".$glob['dbprefix']."customer c 
				         ON c.customer_id = ar.customer_id 
					 LEFT JOIN ".$glob['dbprefix']."inventory i
				         ON i.album_id = a.album_id
					 WHERE c.customer_id = ar.customer_id
					 GROUP BY ar.customer_id";

And the tables involved

 

----artist----  ----albums---    ----customer----  ----inventory----

customer_id--+----artist_id---+----customer_id---+  productId        <--(song id)

points                album_id          screenname        album_id

                                                    email          +--customer_id

and here is wat it looks like with wat i have now

songs.jpg

 

Some1 should help me with this it is needed very baddly

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.