February 3, 2004 at 11:41 pm
how do i get the List of Sundays between two given dates by using a select statement. say for eg. from 01-FEB-2004 to 29-FEB-2004
should give me a list of following dates.
01-FEB-2004
08-FEB-2004
15-FEB-2004
22-FEB-2004
29-FEB-2004
I would like to use this in a query like
SELECT FDATE,COUNT(*) FROM Table1
Where FDate In (Sundays)
Group By FDate
To check the Transaction Count on Sundays basically.
February 4, 2004 at 1:57 am
You could replace your WHERE clause with:
where FDate between '01 FEB 2004' and '29 FEB 2004' and datename(dw, FDate) = 'Sunday'
Cheers,
- Mark
February 5, 2004 at 3:31 am
Thank you very much Mark. So Simple Once you Know, Yet so Difficult.
Thanks again.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply