select吧 关注:45贴子:290
  • 0回复贴,共1

这个sql语句怎么优化

只看楼主收藏回复

select * from (select Minutely_DTU.TerminalId,[BatteryVol],Minutely_DTU.MsgArriveTime,GsmSignalStrength,
ROW_NUMBER() over(partition by Minutely_DTU.TerminalId order by Minutely_DTU.MsgArriveTime desc ) as new_index from Minutely_DTU
inner join DTUServiceInformation on Minutely_DTU.TerminalId=DTUServiceInformation.TerminalId and CancelTime is null
where Minutely_DTU.TerminalId in (select id from Terminal where Id>'6200502884' and model like 'DTU%')) a where a.new_index<='100' order by a.TerminalId


IP属地:河北1楼2016-08-22 10:56回复