Let's pretend today is the 3rd of February.
And I have a table:
CREATE TABLE devotion
(
id serial NOT NULL,
date timestamp without time zone
}
And I have 4 records:
id date
1 2013-01-01
2 2013-02-02
3 2013-03-03
4 2013-04-04
I want to build a select query that would return all records in the following order (ordered by date, but upcoming dates first, passed dates appended to the end of the list) :
id date
3 2013-03-03 (upcoming dates first)
4 2013-04-04
1 2013-01-01 (passed dates appended to the end of the list)
2 2013-02-02
All records have the same year. In fact, year is not important, only day and month are. If you can suggest a better structure, you are very welcome.