I have a table that hows the following rows...
ID | TITLE | ARTIST | ADDED | HITS | HITS THIS WEEK
--------------------------------------------------------------------------------
7505 | Track 2 | Artist 1 | 2009-08-24 10:32:41 | 1539 | 2
7483 | Track 2 | Artist 1 | 2009-08-23 16:58:35 | 1450 | 3
7324 | Track 1 | Artist 1 | 2009-08-14 11:28:18 | 5291 | 1
7320 | Track 1 | Artist 1 | 2009-08-14 10:24:17 | 2067 | 1
What I want to do is is have the the duplicates add up the hits
and hits this week
and display as one row.
I want to fetch the mysql data as it is (with the duplicates), and then using php i wanna sum up the duplicates as one row for echo'ing.
Can someone tell me how I would go about this?
EDIT:
Heres my current sql query...
SELECT `files`.`file_id` , `files_meta`.`title` , `files_meta`.`artists` , `files`.`added` , `files`.`uniquehits` , `files`.`uniquehits_week` , `files_meta`.`filename`
FROM promo_artists
INNER JOIN promo_files ON promo_artists.id = promo_files.artist_id
INNER JOIN files ON files.file_id = promo_files.file_id
INNER JOIN files_meta ON files.file_id = files_meta.file_id
WHERE username = '$username' ORDER BY `files`.`added` DESC