corillo181 Posted June 9, 2008 Share Posted June 9, 2008 hi i have a table which is made of 4 fields id | art_id | song_id | clicks now what i want to do is sum all clicks where the art_id are the same so if i have id | art_id | song_id | clicks 1 23 43 100 2 10 99 34 3 23 44 50 when i do the query i get in return art_id | clicks 10 34 23 150 Quote Link to comment Share on other sites More sharing options...
bobinindia Posted June 9, 2008 Share Posted June 9, 2008 What is your query? Quote Link to comment Share on other sites More sharing options...
corillo181 Posted June 9, 2008 Author Share Posted June 9, 2008 that is what im trying to find out.. how would i make a query that will sum that total clicks where artist_id are the same so something like sum(counter) where artist_id = artist_id Quote Link to comment Share on other sites More sharing options...
corillo181 Posted June 9, 2008 Author Share Posted June 9, 2008 oh forget it i guess that works.. lol i was just typing it wrong.. Quote Link to comment Share on other sites More sharing options...
bobinindia Posted June 9, 2008 Share Posted June 9, 2008 This is more of a MySQL question. You may do better in that forum. artist_id UNIQUE may be part of it. Quote Link to comment Share on other sites More sharing options...
corillo181 Posted June 9, 2008 Author Share Posted June 9, 2008 SELECT `artist_id`, SUM(clicks) `total` FROM `song_clicks` WHERE `artist_id` != 0 GROUP BY `artist_id` this works just in case someone do a search for something like this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.