案例來源:PTT DATABASE版

 

想要知道talbe中有哪幾種副檔名

範例table (fild)如下:

name

123.abc
123tt.pwd
1ee3tt.pdf
1ezz.word
1ezzqq.ptt
1ezzqq.ptt

 

語法: 運用distinct +substr + instr 

****************

select distinct substr(name,instr(name,'.',1),10) from fild;

其中instr(name,'.',1) 是判斷'.'在哪個位子

****************

 

結果:

.abc
.pwd
.ptt
.word
.pdf

 

 

 

文章標籤
全站熱搜
創作者介紹
創作者 to52016 的頭像
to52016

Eason [資料科學//Python學習/資料庫] & [拍片&剪片]

to52016 發表在 痞客邦 留言(0) 人氣(31)