I like some help that made me think for two days. I need to restore data from a database and order its column1 when it is not empty, and then the rest of the result on column2
column1 column2 1 11 2 12 3 13 14 15 16
Desired Result
1,2,3,14,15,16
I tried many approaches, my last unsuccessful attempt
$SQL = "SELECT * FROM table ORDER BY COALESCE(column1,column2) DESC";
and
`$SQL = "SELECT * FROM table ORDER BY COALESCE(column1,column2) ASC";
My above SQL returns the NULL column value of column1 above column2
user1320260
source share