Home >Backend Development >PHP Tutorial >Usage of distinct in Thinkphp
The main purpose of distinct() in TP is to remove duplicate values. Below I will introduce to you the usage of distinct() in Thinkphp through example code. Let’s take a look.
The main purpose of distinct() in TP is It is to remove duplicate values
It is also explained in detail in the Thinkphp manual (link: http://document.thinkphp.cn/manual_3_2.html#distinct)
The following is my personal example :
##The display is like this If you add distinct:The displayed result is The following is the posted code
$offernum = M('offer')->distinct(true)->where('order_id='.$order_id)->field('user_id,number')->select(); dump($offernum);above That’s the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website! Related recommendations:
Usage of session() method in thinkPHP
Constructor _construct( of class in ThinkPHP ) and _initialize()
The above is the detailed content of Usage of distinct in Thinkphp. For more information, please follow other related articles on the PHP Chinese website!