sql union 与多个order by 一起使用
生活随笔
收集整理的這篇文章主要介紹了
sql union 与多个order by 一起使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
經過好長的一段時間,才把union與多個 order by一起聯合使用。先看代碼:
?
?
???select?*?from
???????(select?top?1000??id,?businessNum,rebateNum,specialNum?????????from?counter?
????????where??type?=?1?
??????order?by?businessNum,billNum)?as?t
?????????union?all
????????select?*?from
????????(select?top?1000?id,?businessNum,rebateNum,specialNum
????????from?counter?
????????where???type?=?2
???????order?by?businessNum,billNum)as?tg?
?
?這里需要注意的問題 在內查詢中,要用top 進行限定。
?
?
轉載于:https://www.cnblogs.com/85538649/archive/2011/05/13/2045037.html
總結
以上是生活随笔為你收集整理的sql union 与多个order by 一起使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: BackTrack 5 发布了 ---直
- 下一篇: 浅析php中的stdClass