Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL how do i select using the current month 1

Status
Not open for further replies.

Leej2000

Technical User
Apr 8, 2004
2
GB
I am using SQL to Query a database to select fields for the current month but i am unable to do so so far i have used the following

Select *
From stockTrans
Where stocktrans.date = #**/(now)/**#

How ever this isnt working. All it needs to do is to select the current month items and disregard everything else is this possible and how do you do it?



 
Do you have only records in this year? Just in case you need to select records in current month and year, then try this out.

Select *
From stockTrans
Where DatePart("mm",stocktrans.date) = DatePart("mm",getdate())
and DatePart("yy",stocktrans.date) = DatePart("yy",getdate())

:)
 
cheers Tim will try that out. i believe that they could be more records for over the years. thankyou for your help
Lee

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top