NutzCN Logo
问答 mysql使用dao.executeb报这个错误。nutz版本是1.51。
发布于 2706天前 作者 wx_h8lkiovptng61pn500tb 1857 次浏览 复制 上一个帖子 下一个帖子
标签:

2017-07-26 14:20:22,248 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - select count(1) FROM (SELECT b.appid,a.connecttime,a.connecttimelen,a.remotenum,a.extnum,b.endtype,a.callid,a.agentid,a.outcall FROM Call_Info2 a ,REC_File_Info b WHERE a.CallID=b.CallID and a.agentid is not null and a.agentid!='' and a.ConnectTime>='2017-07-26 14:19:43' and a.DisconnectTime<='2017-07-26 14:19:43' order by a.ConnectTime desc)
2017-07-26 14:20:22,250 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SQLException
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Every derived table must have its own alias

4 回复

完整报错信息

应该是缺了别名, 在语句最后面加上 as _tmp 应该就会好

我查到是execute里执行了求总记录数的sql,select count(1) FROM (SELECT * from XX) ,意思是子句要加别名。应该用哪个方法好

select count(1) FROM (SELECT * from XX) as _tmp

添加回复
请先登陆
回到顶部