sql distinct top

distinct 会作用在多个字段上,没有办法按一个字段去重,再取出其它的字段。

#使用disctinct获取的内容
select * from t
where x not in
(select distinct x from t2)
#取某字段非空的行
select  * from miaopai.bt_micro_user 
where aweme_count is not null
order by aweme_count desc
limit 10
#count(disinct)
select count(distinct publish_nick) from miaopai.bt_micro_user 

参考:
SQL中distinct的用法

猜你喜欢

转载自blog.csdn.net/ml_1019/article/details/81010234
今日推荐