thinkphp mysql field_thinkphp5 sql field问题

上图,正常的语句不知道为什么到了第二个field就被改变了

$temp = implode(',',$temp);

$field = 'comment.*,u.username,moment.moment_content,reply_comment.comment_content as reply_content,';

$field .= "(select count(reply.id) from ncd_moment_comment as reply where comment.id=reply.reply_comment_id and reply.uid not in ({$temp}) ) as u_reply,";

$field .= "(select count(reply.id) from ncd_moment_comment as reply where comment.id=reply.reply_comment_id and reply.uid in ({$temp}) ) as bd_reply";

$list = $this

->alias('comment')

->field($field)

->join('user u','comment.uid=u.user_id','left')

->join('ncd_moment moment','comment.moment_id=moment.id','left')

->join('ncd_moment_comment reply_comment','comment.reply_comment_id=reply_comment.id','left')

->where($map)

->order('comment.comment_release_time desc')

->fetchSql()->select();

echo '

'; var_dump($list);die;

sql语句

string(710) "SELECT `comment`.*,`u`.`username`,`moment`.`moment_content`,reply_comment.comment_content as reply_content,(select count(reply.id) from ncd_moment_comment as reply where comment.id=reply.reply_comment_id and reply.uid not in ('24','25','9917','9921') ) as u_reply,(select count(reply.id) from ncd_moment_comment as reply where comment.id=reply.reply_comment_id and reply.uid in ('24','9921') ) as bd_reply FROM `ncd_moment_comment` `comment` LEFT JOIN `user` `u` ON `comment`.`uid`=`u`.`user_id` LEFT JOIN `ncd_moment` `moment` ON `comment`.`moment_id`=`moment`.`id` LEFT JOIN `ncd_moment_comment` `reply_comment` ON `comment`.`reply_comment_id`=`reply_comment`.`id` ORDER BY comment.comment_release_time desc"

问题

81b4c3f79c10e982de75c666319a1657.png

70d8f110578f18be49b8cc6cdd785a6b.png

787b4f6ae8f74de448124f3175f35e74.png

24f5ce113c0ace4fd09d50644cc02dfe.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值