insert into @temp_traffic_reports(id, assetname,datestamp,messagetype,itemquantity)
(
select
tf.ID as id,
ta.TrackingIdentityName as assetname,
DATEADD(hour,@TimeZoneValue,Datestamp) as datestamp ,
'Poll for position report' as messagetype,
'1' as itemquantity
FROM trackmaps_WHB.dbo.MESForwardMessage tf
join @temp_assets ta
on tf.TerminalID = ta.TrackingIndentity
where
Datestamp between DATEADD(hour,@TimeZoneValue,@fDate) and DATEADD(hour,@TimeZoneValue,@tDate)
);
答案 0 :(得分:1)
SELECT INVOICE_ID, COUNT(CP.INVOICE_ID)
FROM COMPLAINT_AGAINST_PRODUCT CP, COMPLAINT C
WHERE C.COMPLAINT_NO=CP.COMPLAINT_NO AND C.STATUS='CLOSED'
GROUP BY INVOICE_ID
ORDER BY count(CP.INVOICE_ID) DESC
答案 1 :(得分:0)
您必须在比较中强制执行两个排序规则之一
答案 2 :(得分:0)
insert into @temp_traffic_reports(id, assetname,datestamp,messagetype,itemquantity)
(
select
tf.ID as id,
ta.TrackingIdentityName as assetname,
DATEADD(hour,@TimeZoneValue,Datestamp) as DATES_STAMP ,
'Poll for position report' as messagetype,
'1' as itemquantity
FROM trackmaps_WHB.dbo.MESForwardMessage tf
join @temp_assets ta
on tf.TerminalID = ta.TrackingIndentity
CROSS APPLY (SELECT DATES_STAMP) AS A
WHERE A.DATES_STAMP between DATEADD(hour,@TimeZoneValue,@fDate) and DATEADD(hour,@TimeZoneValue,@tDate)
)