
plsql可以执行但是在mybatis报子查询返回多行语句的错误
这是SQL:selectcreate_time,(selectcount(*)fromt_inspectionwhereinsp_status=4groupbycreat...
这是SQL:
select create_time,(select count(*) from t_inspection where insp_status = 4 group by create_time) as finishInsp from t_inspection where to_date(to_char(create_time,'yyyy-mm-dd'),'yyyy-mm-dd') <![CDATA[>=]]> (to_date(to_char(sysdate-30,'yyyy-mm-dd'),'yyyy-mm-dd')) and to_date(to_char(create_time,'yyyy-mm-dd'),'yyyy-mm-dd') <![CDATA[<=]]> (to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')) 展开
select create_time,(select count(*) from t_inspection where insp_status = 4 group by create_time) as finishInsp from t_inspection where to_date(to_char(create_time,'yyyy-mm-dd'),'yyyy-mm-dd') <![CDATA[>=]]> (to_date(to_char(sysdate-30,'yyyy-mm-dd'),'yyyy-mm-dd')) and to_date(to_char(create_time,'yyyy-mm-dd'),'yyyy-mm-dd') <![CDATA[<=]]> (to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')) 展开
1个回答
展开全部
这个:
select count(*) from t_inspection where insp_status = 4 group by create_time
为什么要group by呢,确实有可能返回多行数据啊
可是你放到大的查询里,是不能出现多行的
去掉group by就行了
select count(*) from t_inspection where insp_status = 4
select count(*) from t_inspection where insp_status = 4 group by create_time
为什么要group by呢,确实有可能返回多行数据啊
可是你放到大的查询里,是不能出现多行的
去掉group by就行了
select count(*) from t_inspection where insp_status = 4
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |