例如数据库中有表user,在application\index\model目录下建立文件User.php,然后里面这样写
<?php namespace app\index\model; use think\Model; class User extends Model{ public function aa($id){ }}
几个关键点:…
多表联查count数据来进行统计,会出现重复的数据,这时候在查询中加上distinct来返回不同的值.
DB::name(‘member’)
->alias(‘a’)
->field(‘count( distinct b.id) as followCount,count(distinct c.id) as articleCount,count(distinct d.id) as readBookCount,co…
最近新接入一个二开的项目,tp6的项目内置的composer.json文件里引入的topthink框架包文件却是"topthink/framework": "5.0.*",导致了以下错误:
错误:
Fatal error: Uncaught Error: Call to a member function run() o…
https://blog.csdn.net/wanganji5252/article/details/81736807 转载自这里
Not Found The requested URL /index.php was not found on this server.
看提示是URL地址错误。原因是没有设置服务器地址重写,或者是设置了.htaccess文件,但没有打开重写功…
select cate_id,count(*) as num from trade_order where order_status 1 group by cate_id;
就是 select 类别,count(*) as num from 表名 where order_status 1 group by 类别;
得到的就是按类别排序好的总数量,例如是班级男女的数量,或…