Home >Backend Development >PHP Tutorial >Usage of distinct in Thinkphp

Usage of distinct in Thinkphp

不言
不言Original
2018-06-07 15:39:373508browse

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()

##thinkPHP introduces class methods


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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn