-- display time as h:MM:SS or mm:SS -- sqlite uses || instead of + or CONCAT() and FORMAT() is the same as PRINTF() SELECT ROWID, SUBSTRING(DateCreated, 1,16) as Date, ItemType, ItemName, IIF(PlayDuration > 3599, (PlayDuration/3600) || ':' || FORMAT('%02d', (PlayDuration % 3600 / 60)) || ':' || FORMAT('%02d', (PlayDuration % 3600 % 60)), (PlayDuration / 60) || ':' || FORMAT('%02d', (PlayDuration % 60))) as Time FROM PlaybackActivity WHERE UserId = 'edd3338a60a240549f0fb296c8bab625' ORDER BY rowid DESC