MySQL 查询去重
MySQL About 1,067 wordsDISTINCT
distinct name
是去除name
字段的重复值,返回name
字段列
select distinct name from user;
+-------+
| name |
+-------+
| zs |
| admin |
| loso |
+-------+
distinct name,home
是去除name
和home
共同重复的值并且返回
select distinct name,home from user;
+-------+-------+
| name | home |
+-------+-------+
| zs | China |
| admin | China |
| loso | China |
| zs | xx |
+-------+-------+
GROUP BY
select * from user group by name;
+----+-------+------+---------------------+--------+-------+----------+
| id | name | age | birthday | gender | home | isdelete |
+----+-------+------+---------------------+--------+-------+----------+
| 0 | admin | 0 | 2000-01-01 00:00:00 | | China | |
| 2 | loso | 10 | 2000-01-01 00:00:00 | | China | |
| 1 | zs | 10 | 2000-01-01 00:00:00 | | China | |
+----+-------+------+---------------------+--------+-------+----------+
LIMIT 1
ORDER BY
时间字段 desc LIMIT 1`
SELECT * from org_phone_num WHERE `remove`=0 and phone = '073188872151' ORDER BY last_modified desc LIMIT 1;
Views: 2,634 · Posted: 2019-04-06
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...