distinct用于对表格中的列去重。
使用时用在所有字段之前
select distinct id from table;
对多列进行去重时,直接罗列colomn名称,例如
select distinct cust_uid,prd_id from table;
查询结果是筛掉了table中(cust_uid+prd_id)相同的值
distinct用于对表格中的列去重。
使用时用在所有字段之前
select distinct id from table;
对多列进行去重时,直接罗列colomn名称,例如
select distinct cust_uid,prd_id from table;
查询结果是筛掉了table中(cust_uid+prd_id)相同的值