Am Using SQL SERVER - 2000
Table Structure
CARDEVENTDATE CARDEVENTTIME CARDNO
20090224 92007 485
20090224 92345 321
20090225 163932 168
20090225 164630 471
20090225 165027 488
20090225 165137 247
20090225 165147 519
20090225 165715 518
20090225 165749 331
20090303 162059 240
20090303 162723 518
20090303 155029 386
20090303 155707 441
20090303 162824 331
Cardeventdate
and Cardeventtime
- nvarchar data type
Date and Time is separate column
I want to get a data between
Yesterday 03:00:01 AM to today 03:00:00 AM Day before yesterday 03:00:01 AM to yesterday 03:00:00 AM So On……..
I tried the below mentioned query’s
Select Cardno, cardeventdate, min(cardeventtime), max(cardeventtime)
from table
where cardeventtime between 030001 to 030000
Select Cardno, Cardeventdate, Min(cardeventtime), max(cardeventtime)
from table
where Cardeventtime >030001 and Cardeventtime < 030000
Nothing displayed in the result because it is taking today time from 03.00 am to 03.01am
Select Cardno, Cardeventdate, min (cardeventtime), max (cardeventtime)
from table
where cardeventtime < 030000 and cardeventtime > previous day time – query help
Exactly I need yesterday 03.00.01 am to today 03.00.00 am data’s, Day before yesterday 03.00.01 am to yesterday 03.00.00 am data’s …………………. So on
I need the sql query for the above condition. Can any one help me?
(edit: I need the date from yesterday morning to this morning, up to 03.00am)