All pastes #421653 Raw Edit

Anonymous

public java v1 · immutable
·published 2007-04-02 23:05 UTC
rendered paste body
This gets the song_id and the number of sales of the three most purchased songs:---------------------------------------------------------------------SELECT `music_purchased`.`song_id`, COUNT(`song_id`) AS 'sales' FROM `music_purchased` GROUP BY `song_id` ORDER BY COUNT(`song_id`) DESC LIMIT 0,3;this gets the name of the song knowing the song_id:---------------------------------------------SELECT `song_title` FROM `music_table` WHERE `song_id`=ID;