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!

Extracting Data from Last Month

Status
Not open for further replies.

rjblanch

Programmer
Jan 16, 2003
257
AU
Hi all,
I have written a query that will allow me to extract data from a table that will grab all records from last month -

WHERE EXTRACT(MONTH FROM `DATE_TIME`) = (EXTRACT(MONTH FROM CURDATE()) )

This is all well and good, except for where I wish to run in January, because obviously my month-1 would equal 0.
Is there anyway around this?

thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top