[thelist] SQL query help

listman at hazard0us.org listman at hazard0us.org
Fri Nov 8 06:00:24 CST 2002


If you are using SQL Server you can use datepart () :

Select * from TableName
Where datepart(mm, DATE) = 12
Order by hits

will fetch all the records from TableName for the month of december.
Access also has a datepart function , you have to put the mm  in quotes
like this :

datepart("mm", Date)

Note : if your DATE field is not of data type DATETIME you will
need to cast() or convert() it explicitly into a datetime type.


HTH
ashok

------
Ashok Hariharan
http://www.unganisha.org
------






More information about the thelist mailing list