SQL/MySQL-选择不同/唯一但返回所有列?SELECT DISTINCT field1, field2, field3, ...... FROM table我正在尝试完成以下SQL语句,但我希望它返回所有列,这可能吗?类似于:SELECT DISTINCT field1, * from table
3 回答
江户川乱折腾
TA贡献1851条经验 获得超5个赞
DISTINCT
GROUP BY
field1
field2
field1
field2
GROUP BY
DISTINCT
:
SELECT field1, MAX(field2), COUNT(field3), SUM(field4), .... FROM table GROUP BY field1
守候你守候我
TA贡献1802条经验 获得超10个赞
SELECT * from table GROUP BY field1;
SELECT * FROM persons GROUP BY name;
SELECT * FROM persons GROUP BY lastName, firstName;
添加回答
举报
0/150
提交
取消