其他分享
首页 > 其他分享> > 武汉每个月超限两次的数据

武汉每个月超限两次的数据

作者:互联网

select year(PASSDATETIME) '年',month(PASSDATETIME) '月',vlpn '车牌号',vlpncolor '车牌颜色',count(1) '抓拍次数' into #table1
from OverRecord
group by year(PASSDATETIME),month(PASSDATETIME),vlpn,vlpncolor
having count(1)>=2
order by year(PASSDATETIME),month(PASSDATETIME)


select o.年,o.月,o.车牌号,r.CodeName '车牌颜色',v.OwnerName '机动车所有人',FactoryPlateModel '品牌',e.CodeName '车辆类型',f.CodeName '燃油类型',
IUVTYPE '车辆型号',VRDATE '初登日期'
from #table1 o left join Vehicle v
on o.车牌号=v.vlpn and o.车牌颜色=v.vlpncolor
left join CD_FuelType f on v.FuelType =f.CodeValue
left join CD_VLPNColor r on v.FuelType =r.CodeValue
left join CD_GAVType e on v.GAVType =e.CodeValue
order by o.年,o.月

drop table #table1

 

标签:join,两次,PASSDATETIME,year,武汉,CodeName,month,超限,left
来源: https://www.cnblogs.com/luoguixin/p/12738856.html