We help IT Professionals succeed at work.

Mysql Query - using Date functions

socross
socross asked
on
1,516 Views
Last Modified: 2008-01-09
Hi
I need a bit of help getting a couple of db queries working which work with a date stored in a mysql database.

Query 1
This needs to pull out all rows where invoice_date is greater or equal than the provided date, below is my current attempt

SELECT * FROM invoices WHERE invoice_status = 'sent' AND invoice_date >= 2007-06-14

Query 2
This needs to pull out all rows where invoice_date is in a certain month (based on a YEAR and MONTH 10)

SELECT * FROM invoices WHERE invoice_status = 'sent' AND MONTH('invoice_date') = 10 AND YEAR('invoice_date') = 2007

ANy suggestions would be much appriciated

Many thanks
-s-
Comment
Watch Question

Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
great thanks
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.