Home > Article > Backend Development > Is the thinkphp statistics problem a miracle or a problem with my code? .
This has nothing to do with TP, it is a problem with SQL - you have grouped, and count counts the number of rows in each group...
You can use fetchSql to fetch the SQL, and then try to execute it in the database yourself.
Dear, this is normal, it’s not some magic and your code
is fine. If you use the framework method to see sql
, there is no big difference. You can output sql
and take a look, and you will find that you are thinking too much. Everything works fine
should be 102 records that meet the conditions with 20 unique uids.
The above is the statistics problem of thinkphp. Is it a miracle or a problem with my code? . For more related content, please pay attention to the PHP Chinese website (www.php.cn)!