我要做的就是Scan
从每个''中提取最新的''(因此是'LastScan')location
,然后找出它们中的任何一个是否超过2小时或更多' old
'(这会使它们过期)。
Select cast(max(entered_date) as int) as 'LastScan', location
FROM housing_activity
WHERE 'LastScan' <= Datediff(HH,-2,GETDATE())
Group by location
这是我的错误:
Msg 245, Level 16, State 1, Line 2
Conversion failed when converting the varchar value 'LastScan' to data type int.