=== modified file 'src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs'
--- src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs	2009-03-20 01:11:31 +0000
+++ src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs	2009-03-20 04:35:06 +0000
@@ -355,7 +355,7 @@
                     sort_query = String.Format (@"
                         CoreAlbums.ArtistNameSortKey ASC, 
                         CoreAlbums.TitleSortKey ASC, 
-                        CoreTracks.Disc ASC,
+                        MAX(CoreTracks.Disc, 1) ASC,
                         CoreTracks.TrackNumber {0}", ascDesc); 
                     break;
 
@@ -363,7 +363,7 @@
                     sort_query = String.Format (@"
                         CoreAlbums.ArtistNameSortKey {0}, 
                         CoreAlbums.TitleSortKey ASC, 
-                        CoreTracks.Disc ASC,
+                        MAX(CoreTracks.Disc, 1) ASC,
                         CoreTracks.TrackNumber ASC", ascDesc); 
                     break;
 
@@ -371,14 +371,14 @@
                     sort_query = String.Format (@"
                         CoreArtists.NameSortKey {0}, 
                         CoreAlbums.TitleSortKey ASC,
-                        CoreTracks.Disc ASC,
+                        MAX(CoreTracks.Disc, 1) ASC,
                         CoreTracks.TrackNumber ASC", ascDesc); 
                     break;
 
                 case "album":
                     sort_query = String.Format (@"
                         CoreAlbums.TitleSortKey {0},
-                        CoreTracks.Disc ASC,
+                        MAX(CoreTracks.Disc, 1) ASC,
                         CoreTracks.TrackNumber ASC", ascDesc); 
                     break;
 
@@ -397,7 +397,7 @@
                     sort_query = String.Format (@"
                         CoreAlbums.ArtistNameSortKey ASC, 
                         CoreAlbums.TitleSortKey ASC, 
-                        CoreTracks.Disc {0},
+                        MAX(CoreTracks.Disc, 1) {0},
                         CoreTracks.TrackNumber ASC", ascDesc);
                     break;
 

