经过好长的一段时间,才把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 进行限定。

 

 

相关文章:

  • 2021-09-17
  • 2021-12-27
  • 2021-08-15
  • 2021-06-11
  • 2021-09-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案