语法错误:意外" WHERE" (在哪里)在mysql中

时间:2015-11-25 04:41:04

标签: mysql

这是我的代码:

SELECT s_num, SUM(qty)
FROM S,SPJ
WHERE S.s_num=SPJ.s_num1
GROUP BY s_num
HAVING SUM(qty)>1000;

但我有

  

语法错误:意外" WHERE" (其中,)

请帮助我!

1 个答案:

答案 0 :(得分:1)

您可以使用内部联接获得与以下相同的结果:

SELECT        S.s_num, SUM(S.qty) AS Expr1
FROM            S INNER JOIN
                         SPJ ON S.s_num = SPJ.s_num1
GROUP BY S.s_num
HAVING        (SUM(S.qty) > 1000)