All I am trying to do is pull the most recent 'Scan
' (hence 'LastScan') from each 'location
' and then find out if any of them are 2 hours or more 'old
'(which would make them overdue).
Select cast(max(entered_date) as int) as 'LastScan', location
FROM housing_activity
WHERE 'LastScan' <= Datediff(HH,-2,GETDATE())
Group by location
This is my error:
Msg 245, Level 16, State 1, Line 2
Conversion failed when converting the varchar value 'LastScan' to data type int.