Thinkphp中distincat的用法

TP中distinct()的用处主要是去除重复的值

在Thinkphp手册中也详细说明了(链接:http://document.thinkphp.cn/manual_3_2.html#distinct

下面是我的个人例子:

Thinkphp中distinct的用法

显示是这样的

          Thinkphp中distinct的用法

在加入distinct的话:

Thinkphp中distinct的用法

显示结果为:

Thinkphp中distinct的用法

下面为贴出来的代码

$offernum = M('offer')->distinct(true)->where('order_id='.$order_id)->field('user_id,number')->select();
dump($offernum);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-02-18
  • 2021-04-30
  • 2022-12-23
  • 2021-08-17
猜你喜欢
  • 2021-11-29
  • 2021-11-10
  • 2022-12-23
相关资源
相似解决方案