sql - order non-null values of firstTimestamp ASC, then order the null values after that with secondTimestamp DESC -
i have object looks ->
{ firsttimestamp, secondtimestamp }
i following
- first, order values have firsttimestamp asc, nulls last
- then order nulls secondtimestamp, descending
how go doing in sql?
i'm thinking ->
order first_timestamp asc nulls last, second_timestamp desc
does make sense?
depending on version of sql, may work...
order case when first_timestamp null 1 else 0 end asc, first_timestamp asc, second_timestamp desc
Comments
Post a Comment