distinct 是关键字,不是聚合函数。
1.必须 在 select 后第一位
select distinct name from table;
2.对select 后出现的字段都会去重复
distinct语句中select显示的字段只能是distinct指定的字段,其他字段是不可能出现的。
例如,假如表A有“备注”列,如果想获取distinc name,以及对应的“备注”字段,想直接通过distinct是不可能实现的。
select distinct name from table;
distinct语句中select显示的字段只能是distinct指定的字段,其他字段是不可能出现的。
例如,假如表A有“备注”列,如果想获取distinc name,以及对应的“备注”字段,想直接通过distinct是不可能实现的。