Answer the question
In order to leave comments, you need to log in
How to sort objects so that some of them (by condition) are always at the end?
There are goods. Products have prices. Products can be sorted according to different conditions. Output page by page.
How to make it so that those goods whose price is equal to zero are always at the end?
For some time, no working solutions came to mind, except how to collect an array and display the array page by page.
But it seems that it should be possible to do this at the sampling level as well.
Answer the question
In order to leave comments, you need to log in
Option 1
SELECT .... WHERE price > 0 AND ... ORDER BY ...
UNION
SELECT .... WHERE price = 0 AND ... ORDER BY ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question