Hi Prod,
I was hoping you could help me with an SQL question. I have used your program to generate playlists for individual years, genres, rated artists, etc - but I was wondering what I would need to enter to get the playlists to be created in groups of 10 or something based off a range (e.g. - create smartlists based of BPM values - so I would get a smartlist for each block of 20 - BPM 0 - 20; 21 - 40; 41 - 60; or for decades - so I would get a smartlist for files that had year - 1960 - 1969; 1970 - 1979; 1980 - 1989; etc)
CREATE PROCEDURE [dbo].[BPMsmartlists]
@libraryName NVARCHAR(255) = NULL
AS
SELECT [BPM]
INTO #t
FROM [Files]
WHERE [Rating] >= 1
AND [Media Type] = 'Audio'
GROUP BY [BPM]..............................................................................H ow do I get the range here?
HAVING COUNT(*) > 5
SELECT DISTINCT 'BPM' [PlaylistPath],
[BPM] [PlaylistName],
'[BPM]=[' + [BPM] + '] [Rating]=>=1 ~nodup=[Artist],[Name] ~sort=Random' [Expression],
'BPM: ' + [BPM] + CHAR(13) + CHAR(10) + 'Rating: 1 Stars' + CHAR(13) + CHAR(10) + 'Sort: Random' [Notes]
INTO #t2
FROM [Files]
WHERE [BPM] IN (SELECT [BPM] FROM #t)
SELECT * FROM #t2
SELECT [Path] [PlaylistPath], [Name] [PlaylistName], CAST(1 AS BIT) [Delete]
FROM [Playlists] p1
WHERE [Path] LIKE 'BPM'
AND NOT EXISTS
(
SELECT *
FROM #t2 p2
WHERE p1.[Path] = p2.[PlaylistPath]
AND p1.[Name] = p2.[PlaylistName]
)
DROP TABLE #t
DROP TABLE #t2
Any help or suggestions would be good (as any fyi - I actually haven't tried the above yet - I just copied one of your recipes and changed from Artist to BPM.
Thanks.