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.
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();
2. Merge Duplicate fields
group
$result = M("user")->group("name")->select()
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!