var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Select statement for date range
If I have a customer table, inside got a column named DOB, How can I write a Select statement that query the customer that born on let say
between Jan 13 and Feb 12?
Let say the table look like below
CusId Custname DOB
1 Cust A 1/1/1977
2 Cust B 2/2/1966
3 Cust C 3/3/1988
4 Cust D 4/4/1999
5 Cust E 5/5/1955
Thnks and have a nice day.
any one do this kind of query before?
First I would convert the date of birth into ISO-format (YYYYMMDD). The next step would be to take only day and month and compare this string with your begin and end date of your date range.
A sample code could be:
Hope this helps you out!
select right(convert(varchar, dob, 112), 4) as mmdd
where right(convert(varchar, dob, 112), 4) between '0113' and '0212'
So nice of you, thank you very much.
the query working perfectly this time in query analyser.
I still need to migrade them into delphi...
I owe you a favor! So next time come to Malaysia remember to give me an email o...
Good Luck and have a nice day.