gpt4 book ai didi

sql-server - SQL查询当前不支持返回别名

转载 作者:行者123 更新时间:2023-12-02 16:04:46 25 4
gpt4 key购买 nike

我有这个试图在grails上运行的原始sql

final session = sessionFactory.currentSession;
final String query = 'select count(A.*) from Artifact as A LEFT JOIN classification as C on (A.id=C.artifact_id) where C.id IS NULL OR C.active=0';
final sqlQuery = session.createSQLQuery(query);

def totalunclass = sqlQuery.with {
addEntity(Artifact);
}

但是我收到错误 Message: SQL queries do not currently support returning aliases我尝试了另一种方法,但也无法实现结果,请单击 here

最佳答案

尝试将查询行更改为如下所示

 final  String query  = 'select count(*)  from Artifact A LEFT JOIN classification C on (A.id=C.artifact_id) where C.id IS NULL OR C.active=0';

关于sql-server - SQL查询当前不支持返回别名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26787887/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com