关键词:DISTINCT
1、比如数据库一组数据查询如下,返回店铺下所有的区域id
2、SQL统计返回指定字段 district 不重复的 记录id,SQL如下
SELECT DISTINCT(district ) FROM `t_life_shop`
查询结果如下
3、TP5.1的写法如下
$list = $this->where($where)->distinct(true)->field('district')->select();
关键词:DISTINCT
1、比如数据库一组数据查询如下,返回店铺下所有的区域id
2、SQL统计返回指定字段 district 不重复的 记录id,SQL如下
SELECT DISTINCT(district ) FROM `t_life_shop`
查询结果如下
3、TP5.1的写法如下
$list = $this->where($where)->distinct(true)->field('district')->select();