I have a table called :[order] storing data for 24 hrs,the date and time stamp is stored in a field called [ordertime],I have another field called [date] where I store date only,now when the time reaches mid night, the [date] value changes to the next date, However I would like to reset this date to the Previous date, for the time between 1.00 AM and 7.00 AM in the morning,
Im trying to use this sql statement
update [ORDER]
set [date] = [date] - 1
where DATEPART(hh,ordertime) between 0 and 7
The table name is [order],the fields are:[date] to store the date when information has been entered and [ordertime] to store the date and time.
unfortunately, this routine will also reset the date even for data entered say at 5.0 PM(evening)
Sample data:
ordertime
20/04/2014 16:24:12
20/04/2014 16:24:18
20/04/2014 16:24:27
date
20/04/2014
20/04/2014
20/04/2014