Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: How do i select only year in a field


Message #1 by "COCO LUA SUAT CHOO" <cocolua@h...> on Fri, 24 Aug 2001 04:12:27
I have an access DB here .. i need to write an sql statement to extract the 

records which is in the year selected by the user let's say user select 

1997, my program should display all the record dated at the year 0f 1997.. 

the problem i'm facing now is the field in the db which contain the date is 

in dd/mm/yy.. is there any sql statement which i can use to select the 

record by comparing only the year?

i tried the make program is such the way that set the date to 1st of jan of 

selected year as the startDate and 31st of december of the selected year as 

the endDate and select the record using SQL "select * from course where 

courseDate between startDate and endDate" but it doesn't seem to work... 

nothing was display but in fact it should have!

can anyone help please!

thanks!







_________________________________________________________________

Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp



Message #2 by Renante Milan <renantem@a...> on Fri, 24 Aug 2001 17:24:06 +0800
Use the year function.

Example:

Select year(field) as cyear from tablename



-----Original Message-----

From: COCO LUA SUAT CHOO [mailto:cocolua@h...] 

Sent: Friday, August 24, 2001 12:12 PM

To: ASP Web HowTo

Subject: [asp_web_howto] How do i select only year in a field



I have an access DB here .. i need to write an sql statement to extract the 

records which is in the year selected by the user let's say user select 

1997, my program should display all the record dated at the year 0f 1997.. 

the problem i'm facing now is the field in the db which contain the date is 

in dd/mm/yy.. is there any sql statement which i can use to select the 

record by comparing only the year?

i tried the make program is such the way that set the date to 1st of jan of 

selected year as the startDate and 31st of december of the selected year as 

the endDate and select the record using SQL "select * from course where 

courseDate between startDate and endDate" but it doesn't seem to work... 

nothing was display but in fact it should have!

can anyone help please!

thanks!


  Return to Index