SQL select query order by day and month

后端 未结 4 977
长情又很酷
长情又很酷 2021-01-22 10:17

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
}
         


        
4条回答
  •  后悔当初
    2021-01-22 10:50

    order by case when date1 > now() then 0 else 1 end case, date1

    will give order of 3,4,1,2

提交回复
热议问题