I've been having trouble with a corner case of one query that mostly works. Some albums have split values in a custom [artist sort] field to facilitate cross-referencing. For instance, Layla and Other Assorted Love Songs is sorted on both "Derek Dominos" and "Clapton Eric Dominos". Those sort values don't actually appear, but "Derek and the Dominos" does in both cases.
Furthermore, the list of artists is broadly grouped by first initial, so that both of those entries appear under "C to D". The trouble seems to be that when one album appears twice under the same initials heading the songs will be sent to the playlist unsorted. It works fine when the cross-references are in different initials headings, as in "Hitchcock Robyn Soft Boys" and "Soft Boys", but "C to D" is messing up two more albums (Cult/Death Cult, Davis Coltrane/Coltrane Davis) and "P to S" claims the last problem on Pop Iggy/Stooges.
All of the other albums—cross-referenced or not—work fine; it's just these four that have me scratching my head.
Batch
DROP VIEW IF EXISTS album_artist_query2;
CREATE VIEW album_artist_query2 AS
SELECT coalesce([album artist],[artist],"(no artist)") coal_artist,
coalesce([album artist sort],[album artist],[artist sort],[artist],"(no artist)") coal_artist_sort,
album,
coalesce([album sort],album,"(no album)") album_sort,
coalesce([date sort],date,"unkn") date_display,
coalesce([release sort],'01') release_sort,
discnumber,
tracknumber,
MetaDb_Handle
FROM MediaLibrary
WHERE path NOT LIKE "%\hide\%";
DROP VIEW IF EXISTS album_artist_init_query;
CREATE VIEW album_artist_init_query AS
SELECT (CASE WHEN (coal_artist_sort >="0" AND coal_artist_sort <="Bzzz") THEN "# to B"
WHEN coal_artist_sort >="C" and coal_artist_sort <="Dzzz" THEN "C to D"
WHEN coal_artist_sort >="E" and coal_artist_sort <="Gzzz" THEN "E to G"
WHEN coal_artist_sort >="H" and coal_artist_sort <="Lzzz" THEN "H to L"
WHEN coal_artist_sort >="M" and coal_artist_sort <="Ozzz" THEN "M to O"
WHEN coal_artist_sort >="P" and coal_artist_sort <="Szzz" THEN "P to S"
ELSE "T to Z, Various" END) init_group,
album||" ("||date_display||")" album_display,
date_display,
coal_artist,
coal_artist_sort,
album_sort,
release_sort,
discnumber,
tracknumber,
MetaDb_Handle
FROM album_artist_query2;
Query
SELECT init_group,
coal_artist,
album_display
FROM album_artist_init_query
GROUP BY album_display,coal_artist_sort,init_group
ORDER BY coal_artist_sort,date_display,album_sort||coal_artist_sort,album_display,
release_sort,discnumber,tracknumber