简体   繁体   English

SQL查询包含格式错误的结尾

[英]The SQL query contains a malformed ending

I got the following error when the server tried to execute the SQL request. 当服务器尝试执行SQL请求时,出现以下错误。

Please, I'd like to know what is incorrect. 请,我想知道什么是不正确的。

Exception Description: Syntax error parsing [SELECT t FROM Trackings t GROUP BY t.dateTrackings WHERE EXISTS (SELECT DISTINCT tr.dateTrackings from Trackings tr )].

You need to mention the column in the SELECT clause. 您需要在SELECT子句中提及该列。

You cant just mention the table alias t 您不能只提及表别名t

and

WHERE should come before GROUP BY . WHERE应该来之前GROUP BY
Any condition to apply upon GROUP BY .. You need to use HAVING clause 适用于GROUP BY任何条件。您需要使用HAVING子句

Something like : 就像是 :
SELECT t.dateTrackings, count(*) FROM Trackings t WHERE EXISTS (SELECT * FROM Trackings tr WHERE tr.dateTrackings = t.dateTrackings) GROUP BY t.dateTrackings

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM