Answers for "sort with if mysql"

SQL
0

mysql order by on condition

SELECT * 
    FROM my_table 
    WHERE 1  
    ORDER BY 
      CASE price WHEN 0 THEN 1
       ELSE -1
      END ASC, price asc, id asc
Posted by: Guest on July-09-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language