SQL语句合并结果集,并且排序
2020-04-22 本文已影响0人
京樂春水
使用"UNION [ALL]"命令,可以实现多条SQL语句结果的合并
不加"ALL"会在多条结果中进行去重,示例:
SELECT AccountID, InstrumentID, PosiDirection, Position FROM `t_FuturePosition` WHERE AccountID = '9099'
UNION ALL
SELECT AccountID, InstrumentID, PosiDirection, Position FROM `t_FuturePosition` WHERE AccountID = '99099'
ORDER BY InstrumentID