What is wrong with this SQL query?

General discussion on PHP

What is wrong with this SQL query?

Postby sona3547 on Mon Jun 27, 2016 9:02 am

SELECT Id, YEAR(BillingDate) AS BillingYear
FROM Invoices
WHERE BillingYear >= 2010;

i am building a small web site in php and the back hand using sql
i am stuck here pls tell me what to do now

thanks in advance
sona3547
 
Posts: 1
Joined: Mon Jun 27, 2016 9:00 am

Re: What is wrong with this SQL query?

Postby zvika on Mon Jun 27, 2016 12:38 pm

Hi
What is the MySQL error?
Are you sure the WHERE clause accepts a calculated value before it is actually calculated?
Try to use 'WHERE YEAR(BillingDate) >= 2010' and see if it works.
I didn't check that, but if this fails, I will :)
Zvika Dror
Zend Support Team
User avatar
zvika
Zend Global Support
 
Posts: 992
Joined: Sun Dec 14, 2008 9:48 am

Re: What is wrong with this SQL query?

Postby rob6279 on Tue Mar 20, 2018 12:04 pm

Can you print out the error it is [url=#]reading[/url]?
rob6279
 
Posts: 5
Joined: Tue Mar 20, 2018 11:44 am


Return to PHP

Who is online

Users browsing this forum: No registered users and 3 guests