As I mentioned in my previous post, I'm trying to audit several fields I think are interfering with sorting in some of my other apps. I'm trying to build a tree with nodes for each Composer field in my library with a count of tracks that have that field. The nodes are created, their count is appended to the end, and they're sorted properly. But, when I click on the node nothing happens. The Action is set to send to a playlist.
Batch
DROP TABLE IF EXISTS BadFieldTable;
CREATE TABLE BadFieldTable AS
SELECT CASE WHEN [composers] IS NOT NULL THEN 'composers' END AS Node1, album, discnumber, tracknumber, path, subsong FROM MediaLibrary WHERE [composers] IS NOT NULL
UNION ALL SELECT CASE WHEN [composersort] IS NOT NULL THEN 'composersort' END AS Node1, album, discnumber, tracknumber, path, subsong FROM MediaLibrary WHERE [composersort] IS NOT NULL
UNION ALL SELECT CASE WHEN [composersortorder] IS NOT NULL THEN 'composersortorder' END AS Node1, album, discnumber, tracknumber, path, subsong FROM MediaLibrary WHERE [composersortorder] IS NOT NULL
UNION ALL SELECT CASE WHEN [conductor] IS NOT NULL THEN 'conductor' END AS Node1, album, discnumber, tracknumber, path, subsong FROM MediaLibrary WHERE [conductor] IS NOT NULL
;
Query
SELECT
Node1 || ' (' || COUNT(path) || ')' AS NodeCount
FROM BadFieldTable
GROUP BY Node1
ORDER BY COUNT(path) DESC, album, discnumber, tracknumber COLLATE NaturalNoCase
This Query sends tracks to the playlist as expected, so I guess it has something to the do with the COUNT(path) that I added.
SELECT
Node1
FROM BadFieldTable
GROUP BY Node1
ORDER BY Node1, album, discnumber, tracknumber COLLATE NaturalNoCase
I found this post in the forum and the part where fbuser says "You need to define queries in that way, that the result is one track per row" maybe my problem. But, modifying the suggestions to my problem didn't work.
Thanks for any help!