Order by Column1 if Column1 is not null, otherwise order by Column2
Try this
ORDER BY COALESCE(fieldA, fieldB);
Something like:
ORDER BY CASE
WHEN Column1 IS NOT NULL THEN Column1
ELSE Column2
END
Or the corresponding syntactic sugar:
ORDER BY COALESCE(Column1, Column2)
Note that the datatype of the two columns must be comparable (the RDBMS defines the rules).