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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select dates forward from month...

Status
Not open for further replies.

burnside

Technical User
Dec 4, 2004
236
GB
i want to count how many records where dealdeldate is in the current month and how many are forward of the current month.
many thanks to PHV

so far

dealdeldate is in the current month

SELECT Count(*) AS countfwdeal FROM tbl_deal WHERE 100*Year(dealdeldate)+Month(dealdeldate)=100*Year(getDate())+Month(getDate())

forward of the current month
SELECT Count(*) AS countfwdeal FROM tbl_deal WHERE 100*Year(dealdeldate)+Month(dealdeldate)>100*Year(getDate())+Month(getDate())

i get this error

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[MySQL][ODBC 3.51 Driver][mysqld-4.0.21-debug]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '())+Month(GetDate())' at line 1
/dfasp2/dealanalysis.asp, line 42
 
To get the current date, you can use CURDATE(), not getdate().
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top