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

熱線電話:13121318867

登錄
2018-10-18 閱讀量: 1136
SQL中distinct的用法?

table表如下

id name

1 a

2 b

3 c

4 c

5 b

Test1

select distinct name from table

----------

name

a

b

c

Test2

select distinct name, id from table

----------

id name

1 a

2 b

3 c

4 c

5 b

注:distinct同時作用了兩個字段

Test3

select id, distinct name from table

----------

出錯

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

Test4

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的字段,且只會匹配出第一個出現(xiàn)的結(jié)果

0.0000
2
關(guān)注作者
收藏
評論(0)

發(fā)表評論

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