99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
2019-01-17 閱讀量: 802
MySQL去重查詢distinct

table表如下:

id name

1 a

2 b

3 c

4 c

5 b

1、select distinct name from table

----------

name

a

b

c

2、select distinct name, id from table

----------

id name

1 a

2 b

3 c

4 c

5 b

distinct同時(shí)作用了兩個(gè)字段

3、select id, distinct name from table

----------

出錯(cuò)

注:distinct必須放在所有字段之前

4、select *, count(distinct name) from table group by name

----------

id name count(distinct name)

1 a 1

2 b 1

3 c 1

注:這樣就能去掉重復(fù)name的字段,且只會(huì)匹配出第一個(gè)出現(xiàn)的結(jié)果

2.9470
3
關(guān)注作者
收藏
評(píng)論(0)

發(fā)表評(píng)論

暫無(wú)數(shù)據(jù)
推薦帖子