Find out date range for last 4 and 52 weeks [message #442418] |
Sun, 07 February 2010 23:00  |
sghoshal
Messages: 5 Registered: April 2007 Location: Kolkata
|
Junior Member |
|
|
Hi,
I have a column in db DELIVERY_PERFORMANCE_YYWW (CHAR(6)). I have to select all records from the table where
DELIVERY_PERFORMANCE_YYWW between current date and current date - 4 weeks.
Can anyone please suggest the best way to do this.
Thanks.
|
|
|
|
Re: Find out date range for last 4 and 52 weeks [message #442435 is a reply to message #442418] |
Mon, 08 February 2010 01:02   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
sghoshal wrote on Mon, 08 February 2010 06:00Hi,
I have a column in db DELIVERY_PERFORMANCE_YYWW (CHAR(6)).
Wow.. 3 possible flaws in 1 go.
1) Dates are stored in date-fields
2) Use of CHAR for things other than non-nullable CHAR(1) fields is something that should at least be thought over twice
3) a column name implying a 4 digit code stored in 6 positions.
For your question, Blackswan already provided the best solution.
|
|
|
|