Dates and Time are stored as a decimal in the database; how do I convert them to a string in a SQL query?
I want to create a query for LastTimePlayed that can be filtered by artist or song title.
Database DateTime format - SQL Query
Moderator: Gurus
-
IanRTaylorUK
- Posts: 618
- Joined: Fri Dec 27, 2019 4:41 pm
Re: Database DateTime format - SQL Query
Media Monkey uses the Julian Date / Offset and can be used to sort or select.
Use the SQL Editor add-on initially to create a query.
You might want to start with something like:
SELECT Songs.Artist, Songs.SongTitle, Played.PlayDate
FROM Played
JOIN Songs on Played.IDSong = Songs.ID
WHERE Songs.Artist LIKE '%Pink Floyd%'
ORDER BY Played.PlayDate DESC;
Take your chosen query and then run it in the Custom Nodes add-on as a "Tracks" type. By using Custom Nodes, you overcome the limitation of the "number of records" shown by SQL Editor BUT your SELECT will need to be generic i.e. SELECT *.
Once you have a Custom Nodes query you can use things like the Column Filter / Sort.
This should help.
Use the SQL Editor add-on initially to create a query.
You might want to start with something like:
SELECT Songs.Artist, Songs.SongTitle, Played.PlayDate
FROM Played
JOIN Songs on Played.IDSong = Songs.ID
WHERE Songs.Artist LIKE '%Pink Floyd%'
ORDER BY Played.PlayDate DESC;
Take your chosen query and then run it in the Custom Nodes add-on as a "Tracks" type. By using Custom Nodes, you overcome the limitation of the "number of records" shown by SQL Editor BUT your SELECT will need to be generic i.e. SELECT *.
Once you have a Custom Nodes query you can use things like the Column Filter / Sort.
This should help.
Ian Taylor