Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mjomha
Starting Member
3 Posts |
Posted - 2011-12-21 : 02:48:37
|
Hey guys!I'm studying for my finals and practicing on some microsoft access questions and I stumbled upon a very confusing question.Its typically 2 tables Albums and Songs...I am trying to List all songs for all albums ordered alphabetically by album title and for songs from the same album by song title.I know how to to do each part separately this is what I got for the first part:SELECT Atitle, StitleFROM ALBUM, SONGWHERE ALBUM.AID=SONG.AIDORDER BY Atitle ASCAs for the SONGS its similar to the above.What I am couldn't figure out is how to combine both queries together to get: Albums sorted alphabetically AND songs in each album sorted alphabetically all in one query.I tried UNION function but I keep getting an error that I can't use 2 ORDER BY functions.Can someone please help me out Got my final exam today at about 7 PM (Dec 21st) and worried that something similar might be on the test.Thanks..M.Jomha |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-12-21 : 03:03:14
|
[code]ORDER BY Atitle ASC, Stitle ASC[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
mjomha
Starting Member
3 Posts |
Posted - 2011-12-21 : 06:09:59
|
Thanks never realized to try that...If I want to sort the songs in alphabetical order within each album and at the same time sort the album titles in alphabetical order would the "GROUP BY" function be any use?SO to include GROUP BY Atitles then add ORDER BY Atitles ASC, Stitles ASC;Thanks for the help I really appreciate it.M.Jomha |
|
|
mjomha
Starting Member
3 Posts |
Posted - 2011-12-21 : 14:03:40
|
quote: Originally posted by khtan
ORDER BY Atitle ASC, Stitle ASC KH[spoiler]Time is always against us[/spoiler]
Thanks friend for the help it worked :)I can now go to my test relaxed!Have a nice day!M.Jomha |
|
|
|
|
|