日期:2014-05-17 浏览次数:20695 次
'insert into '+@ResultTable
+ ' select a.EXITSTATION,b.STATIONNAME,11,RTRIM('+@TollDate+')+''a.exitdate'',a.recordtype,
sum(sign(a.vehicleclass^1)^1) ,
sum(sign(a.vehicleclass^2)^1) ,
sum(sign(a.vehicleclass^3)^1) ,
sum(sign(a.vehicleclass^4)^1) ,
sum(sign(a.vehicleclass^11)^1) ,
sum(sign(a.vehicleclass^12)^1) ,
sum(sign(a.vehicleclass^13)^1) ,
sum(sign(a.vehicleclass^14)^1) ,
sum(sign(a.vehicleclass^15)^1) ,
0,0,0
from '+@BaseTable+ ' AS A,BASE_STATION380 AS B'
+' where 1=1 '+case when @Record<>'' then ' and a.Recordtype&'+@Record+'='''+@Record+''' ' else '' end
+' and a.EXITSTATION = B.STATIONID'
+' and a.Exitstation = '+ CASE ISNULL(@Station,'')
WHEN '' THEN 'a.Exitstation'
ELSE @Station
END
+' and a.EXITDATE = '+ CASE ISNULL(@Exitdate,'')
WHEN '' THEN 'a.EXITDATE'