如何从mysql db中删除(或选择)所有唯一行?
+-----------+----------+------------+
| FirstName | LastName | BirthDate |
+-----------+----------+------------+
| Tia | Carrera | 1975-09-18 |
| Tia | Carrera | 1975-09-18 |
| Nikki | Taylor | 1972-03-04 |
| Yamila | Taylor | 1972-03-04 |
+-----------+----------+------------+
已删除或已选择的行必须是完全重复。示例输出
+-----------+----------+------------+
| FirstName | LastName | BirthDate |
+-----------+----------+------------+
| Tia | Carrera | 1975-09-18 |
| Nikki | Taylor | 1972-03-04 |
| Yamila | Taylor | 1972-03-04 |
+-----------+----------+------------+
答案 0 :(得分:4)
您想使用SELECT DISTINCT
查询而不是SELECT
查询。
示例:
SELECT DISTINCT
FirstName,
LastName,
BirthDate
FROM YourTable;
这会将所有相同的行合并为一个结果。