生成的SQL语句少了一个条件这是TP5的bug吗?

浏览:288 发布日期:2018/07/30 分类:ThinkPHP5专区
$field = 'user_id, sum(quantity) as total, sum(if(goods_id=2,`quantity`, 0)) as total2, sum(if(goods_id=3,`quantity`, 0)) as total3 ';

生成SQL语句后:变成:
`user_id`,sum(quantity) as total,sum(if(goods_id=2,`quantity`,0)) as total2,sum(if(goods_id=3,0)) as total3

少了,`quantity`,结果SQL报错。
最佳答案
评论( 相关
后面还有条评论,点击查看>>