Is it possible to write a SQL query that sorts data set by day of week starting from a specific day?
For example, if today is Thursday, the results are sorted from THU-FRI-SAT-…-MON-TUE-WED.
If today is Tuesday, the results would be sorted from TUE-WED-THU-…-SAT-SUN-MON.
Days are stored as integers.
Assuming you have the day of the week stored into field
WDwhere value 1 means MON, 2 means TUE etc andSWis the “start of the week” index (again 1:MON, 2:TUE,…) then something likeshould give you a value to order by. I don’t use sqlite so I’m not sure can you put it right into the
ORDER BYor do you have to use it as a field and then order by that field.