阅读背景:

存储过程如何实现SQL语句的UNION功能?

来源:互联网 
需要实现的SQL语句如下:
select * from(select top {0} a.companyNo as R1,a.carNo as R2,b.BeginTime as R3,b.EndTime as R4,b.SumTime as R5,b.ELongitude as R6,b.ELatitude as R7,b.EPosition as R8 from carreg a, SumCarRunTime b where a.carid=b.carid and a.CarId='{1}' and b.EndTime >= '{2}' and b.BeginTime <= '{3}'order by a.CarId,b.BeginTime) A union all Select * From (select top {0} a.companyNo as R1,a.carNo as R2,b.BeginTime as R3,b.EndTime as R4,b.SumTime as R5,b.Longitude as R6,b.Latitude as R7,b.PositionInfo as R8 from carreg a, SumCarStopTime b where a.carid=b.carid and a.CarId='{1}' and b.EndTime >= '{2}' and b.BeginTime <= '{3}'order by a.CarId,b.BeginTime) B select * from(select top {0} a



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: