mysql 子查询sum失效

 

代码:

// 在mysql5.6,运行正常,5.7报错
SELECT sum((
select a.num where a.status =1) ) as total FROM mes_order_product AS a LEFT JOIN mes_order AS b ON a.osn = b.osn

 

修改后的代码,增加了表明limit

// 5.6 和5.7运行都正常
SELECT sum((
select a.num from mes_order_product where a.status =1 limit 0,1)) as total FROM mes_order_product AS a LEFT JOIN mes_order AS b ON a.osn = b.osn

 

mysql 子查询sum失效

上一篇:GitHub 如何创建 Access Token


下一篇:用SQL语句,删除掉重复项只保留一条