Answer the question
In order to leave comments, you need to log in
How to ignore negative values when sorting PostgreSQL?
When sorting values, you must ignore the values \u003d -1 by type NULLS LAST.
Something like:SELECT * FROM table ORDER BY column -1 LAST
Answer the question
In order to leave comments, you need to log in
order by case when column = -1 then null else column end nulls last
or even simpler:
order by nullif(column,-1) nulls last
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question