Hi, i have a sql server data table which contains media information of songs like mediaID, mediaName, albumID, singerID and genre. can someone help me write a sql query getting the last song of each of the last 4 albums (the last song of each album) and
secondly, the last song of each of the 4 last entered genre. the album names and data are in different table and connected to the media table by the id. so, what i need to do is some thing like- get the 4 last albumID, and give me one song data for each of
them.
i tried to use "distinct", but i can't get all the table information by using it.
yanivhanya
Participant
1155 Points
323 Posts
select distinct from multipale tables
May 01, 2012 06:49 AM|LINK
Hi, i have a sql server data table which contains media information of songs like mediaID, mediaName, albumID, singerID and genre. can someone help me write a sql query getting the last song of each of the last 4 albums (the last song of each album) and secondly, the last song of each of the 4 last entered genre. the album names and data are in different table and connected to the media table by the id. so, what i need to do is some thing like- get the 4 last albumID, and give me one song data for each of them.
i tried to use "distinct", but i can't get all the table information by using it.
thanks...