I have two datetime columns: data1 and data2. I need to sort by the shortest date between the two columns. If data2 is not zero, displays data2 line; If data2 is zero, displays data1 line; How do I do it? Please, thank you.
I solved it like this: SELECT
data1,data2, REPLACE(data2,'0000-00-00 00:00:00', date(data1)) ordains FROMtabelaORDER BY orders ASC– Daniel