Home > PHP Framework > ThinkPHP > body text

How to remove duplicate values ​​in thinkphp

藏色散人
Release: 2022-01-06 15:20:51
Original
4270 people have browsed it

Thinkphp method to remove duplicate values: 1. Open the corresponding TP file; 2. Use the "$result = M("order")->distinct(true)->select();" method Just remove duplicate data.

How to remove duplicate values ​​in thinkphp

The operating environment of this article: Windows7 system, ThinkPHP5 version, Dell G3 computer.

How to remove duplicate values ​​in thinkphp?

ThinkPHP Remove duplicate data and merge duplicate fields

1. Remove duplicate data

distinct

$result = M("order")->distinct(true)->select();
Copy after login

2. Merge Duplicate fields

group

$result = M("user")->group("name")->select()
Copy after login

For example: name is repeated and only one field is displayed

Recommended learning: "The latest 10 thinkphp Video tutorial

The above is the detailed content of How to remove duplicate values ​​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