MySQL简单问题CURDATE()

时间:2010-04-24 05:18:42

标签: datetime mysql

我想比较两个结果 一个存储在第一个查询中,另一个与第一个查询完全相同,但我只想接收数据<今天

    "SELECT  s.GSP_nom as nom, timestamp, COUNT(s.GSP_nom) as nb_votes, AVG(v.vote+v.prix+v.serviceClient+v.interface+v.interface+v.services)/6 as moy
   FROM votes_serveur AS v
   INNER JOIN serveur AS s ON v.idServ = s.idServ
    WHERE s.valide = 1
   AND v.date < CURDATE()
   GROUP BY s.GSP_nom 
            HAVING nb_votes > 9 
            ORDER BY moy DESC LIMIT 0,15";

是正确的吗? 谢谢

1 个答案:

答案 0 :(得分:2)

GROUP BY,而非ROUP BY
v.date < CURDATE()看起来像o.k。