ORDER BY with a UNION of disparate datasets (T-SQL)

后端 未结 4 2027
无人共我
无人共我 2021-02-19 04:41

I have a query that UNION\'s two somewhat similar datasets, but they both have some columns that are not present in the other (i.e., the columns have NULL values in

4条回答
  •  既然无缘
    2021-02-19 05:09

    A quick solution would be to do 2 inserts into a temp table or a table variable and as part of insert into the temp table you can set a flag column to help with sorting and then order by that flag column.

提交回复
热议问题