How to have a custom sort order for a union query in Postgres

后端 未结 3 1618
深忆病人
深忆病人 2021-02-13 11:50

With a query like this (simplified for clarity):

SELECT \'East\' AS name, *
FROM events 
WHERE event_timestamp BETWEEN \'2015-06-14 06:15:00\' AND \'2015-06-21 0         


        
3条回答
  •  野的像风
    2021-02-13 12:10

    By adding an extra column for ordering purpose, however it makes the UNION clause to work exactly as a UNION ALL (it does not eliminate duplicate rows from the result).

提交回复
热议问题