我觉得我在这里犯了一个明显的错误,但我一直在看它太久了。每当我运行这一行时:
SELECT CONCAT(Name, ' in ', city, ', ', statecode) AS 'Publisher Name and Location', COUNT(ISBN) AS '# Books', Max(Length(Title)) AS 'Longest Title', Min(Length(Title)) AS 'Shortest Title',
FROM publisher
JOIN book ON (publisher.publisherID = book.publisherID)
WHERE INSTR(name, 'read') > 0
GROUP BY Name
HAVING COUNT(ISBN) > 1;
我收到一条错误消息,指出'FROM publisher JOIN book ON(publisher.publisherID = book.publisherID)WHERE INS'
出现语法错误答案 0 :(得分:1)
删除逗号
AS 'Shortest Title', FROM publisher
^----here
答案 1 :(得分:1)
移除,
FROM publisher JOIN book
答案 2 :(得分:1)
通过删除AS 'Shortest Title', FROM publisher
中的逗号来尝试此操作:
SELECT CONCAT(Name, ' in ', city, ', ', statecode) AS "Publisher Name
and Location", COUNT(ISBN) AS "# Books",
Max(Length(Title)) AS "Longest Title", Min(Length(Title)) AS "Shortest Title"
FROM publisher JOIN book ON (publisher.publisherID = book.publisherID)
WHERE INSTR(name, 'read') > 0 GROUP BY Name HAVING COUNT(ISBN) > 1;
答案 3 :(得分:0)
是否有可能是因为您在同一声明中有WHERE
和HAVING
?