I have this DB table in which data is constantly being added to. The Data that is being added is sensor data so there are two readings per sensor per hour. I would like to know of a way to get only the last reading of the day for the entire month. For example,
select * from dbo.NewLogTable
where Sensor_ID= '12345'and Date_Reading between '2012-08-01' and '2012-08-31'
and DateTimeStamp between '23:30:00'and '23:59:00'
order by DateTimeStamp asc
I know this doesn’t work but its a pseudo code of what I want. Again the goal here is to get just one reading(the latest) per day for a particular sensor. I have seen plenty of example where the first and last day of the month are displayed, display past x amount of days, etc. Not really like my application. Can anyone help? thanks.
1 Answer