ccrevcypsys Posted November 7, 2007 Share Posted November 7, 2007 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 Some1 should help me with this it is needed very baddly Link to comment https://forums.phpfreaks.com/topic/76445-pulling-artists/ Share on other sites More sharing options...
fenway Posted November 8, 2007 Share Posted November 8, 2007 This is now the THIRD identical topic you've posted -- that's quite enough. Both Barand and I have helped you with this... I suggest you continue the initial thread, mark it "unsolved", and take it from there.... Link to comment https://forums.phpfreaks.com/topic/76445-pulling-artists/#findComment-387802 Share on other sites More sharing options...
Recommended Posts