Thinkphp5 sql field problem

above, I don"t know why the normal sentence was changed to the second 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 statement
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"

question

clipboard.png

clipboard.png

clipboard.png

clipboard.png

Dec.17,2021

has been solved, but another method, the original one here, will be found that the field method of the db class is cut, and there are only 4 heads and tails left in the class 1, 2 and 3, which is written in another way: code

.

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34a40-2bf35.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34a40-2bf35.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?