码迷,mamicode.com
首页 > 其他好文 > 详细

遥测超标关联黑烟车信息

时间:2020-05-27 18:41:34      阅读:78      评论:0      收藏:0      [点我收藏+]

标签:case   oledb   sql   stat   source   desc   station   sda   ted   

--步骤1
select c.CodeName ‘点位‘,r.PASSDATETIME ‘时间‘,r.VLPN ‘车牌‘,r.VLPNCOLOR ‘车牌颜色‘,r.No ‘NO‘,sf ‘不透光‘,
case when IsValid=0 then ‘无效‘ else ‘有效‘ end ‘数据有效性‘,
(select top 1 a.stationcode from opendatasource(‘SQLOLEDB‘,‘Data Source=172.27.22.30;user ID=sa;password=hbjjgzx@skyland84‘).[Skyland.VIM.VIProv.ShanTou].dbo.[InspectionData] a where a.vlpn=r.vlpn and a.vlpncolor=r.vlpncolor order by IUIDATE desc) ‘检测站编码‘,
(select top 1 a.IUIDATE from opendatasource(‘SQLOLEDB‘,‘Data Source=172.27.22.30;user ID=sa;password=hbjjgzx@skyland84‘).[Skyland.VIM.VIProv.ShanTou].dbo.[InspectionData] a where a.vlpn=r.vlpn and a.vlpncolor=r.vlpncolor order by IUIDATE desc) ‘检测时间‘
--v.IUIDATE ‘检测时间‘
into #table1 from RemoteDetection r
inner join CD_BGStation c on r.StationCode=c.CodeValue
where DETECTIONSTATE=‘0‘ and PASSDATETIME>=‘2020-01-01 00:00:00‘

select t.点位,t.NO,t.不透光,t.车牌,t.车牌颜色,t.时间,t.数据有效性,s.stationName ‘检测站‘,t.检测时间 from #table1 t
inner join stationinfo s on t.检测站编码=s.stationcode

--步骤2
drop table #table1

 


遥测超标关联黑烟车信息

标签:case   oledb   sql   stat   source   desc   station   sda   ted   

原文地址:https://www.cnblogs.com/luoguixin/p/12975186.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!