Skip to content

Instantly share code, notes, and snippets.

@vastus
Created October 27, 2015 09:22
Show Gist options
  • Select an option

  • Save vastus/2e3a05a80f128fa9891d to your computer and use it in GitHub Desktop.

Select an option

Save vastus/2e3a05a80f128fa9891d to your computer and use it in GitHub Desktop.
select
week_day
from
course_classes
order by
((week_day + 2) % 7) -- where 2 is the current wday
;
week_day
----------
5
5
6
6
0
0
1
1
1
1
2
2
3
3
3
4
4
(17 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment