SELECT a.*,(SELECT COUNT(*) FROM user_collect WHERE user_id = a.id and type=1) Num1, (SELECT COUNT(*) FROM user_collect WHERE user_id = a.id and type=2) Num2 FROM user a
`getCount()`函数执行了一个简单的`COUNT()`查询,用于获取`mytable`中的数据总数。 ```php public function getCount(){ $sql="select count(id) as t from `mytable`"; return $this->query($sql); } ``` 在...