Home > database >  Recently ordered 24 hours
Recently ordered 24 hours

Time:09-15

If it is three o 'clock in the afternoon,, sort of 16.17 18.19, 20, 21, 22. 23.24.01. 2. 3. 4. 5.6.7.8.9.10.11.12.13.14.15

CodePudding user response:

The order by case when col1 & gt; To_char (sysdate, 'hh24) then 0 else 1 end, col1

CodePudding user response:

FROM the SELECT S (SELECT TO_DATE (' 20200101 ', 'YYYYMMDD') + (LEVEL 1)/24 S FROM DUAL CONNECT BY LEVEL & lt; T=24)
The ORDER BY CASE WHEN TO_CHAR (S, 'HH24) & gt;=TO_CHAR (SYSDATE, 'HH24) THEN one ELSE 2 END, TO_CHAR (S,' HH24 ');
  • Related