SQL语句怎么筛选表中某一字段不重复的数据行数?

如题所述

第1个回答  2022-11-16
可以参考使用如下写法\x0d\x0a如果要全部数据则可以\x0d\x0a\x0d\x0aselect * from table T1 where 字段 = (select max(字段) from table T2 where T1.字段2 = T2.字段2)\x0d\x0a或\x0d\x0aselect * from table T1 where not exists(select * from table T2 where T1.字段2 = T2.字段2 and T1.字段 < T2.字段 \x0d\x0a\x0d\x0a如果只是数据行数则可以\x0d\x0aselect count(distinct 字段)from table