Usage of distinct in Thinkphp

不言
Release: 2023-03-30 14:00:02
Original
3473 people have browsed it

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);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template