查询工作正常的MS SQL,但在PHP中给出错误

时间:2018-12-15 11:15:21

标签: php sql-server

select count(ratings) as number_of_ratings,sum(ratings) as sum_of_ratings 
from performance_reviews 
where year(review_date)=2004 and employee_id='00009-1761417-9';

我正在php中执行QUERY,它给出了错误

  

'2004'附近的语法不正确

我也尝试过

select count(ratings) as number_of_ratings,sum(ratings) as sum_of_ratings 
from performance_reviews 
where year(review_date)='2004' and employee_id='00009-1761417-9';

我的php查询为

$query = "select count(ratings) as number_of_ratings,sum(ratings) as sum_of_ratings 
          from performance_reviews 
          where year(review_date)='$year' and employee_id='$emp_id'";

其中有什么错误

0 个答案:

没有答案