Firebird- Select 单词字符串中的特定单词
Firebird- Select specific word from string of words
我有一串 words/address ..
ID | ADDRESS
1 barangay1, City Province
2 barangay2, City Province
我想做的是select只有没有市和省的描笼涯
ID | ADDRESS
1 barangay1
2 barangay2
我试过使用 Position() 但它只有 returns 整数..有人可以帮忙吗
除了POSITION() function you need the SUBSTRING()函数提取字符串的一部分。如果您感兴趣的字符串是从字符串的开头到第一个逗号,则
select SUBSTRING(ADDRESS from 1 for POSITION(',' in ADDRESS)-1) from T
应该可以。您可能还想 运行 通过 TRIM() 函数的结果以去除任何前导 and/or 尾随空格。
我有一串 words/address ..
ID | ADDRESS
1 barangay1, City Province
2 barangay2, City Province
我想做的是select只有没有市和省的描笼涯
ID | ADDRESS
1 barangay1
2 barangay2
我试过使用 Position() 但它只有 returns 整数..有人可以帮忙吗
除了POSITION() function you need the SUBSTRING()函数提取字符串的一部分。如果您感兴趣的字符串是从字符串的开头到第一个逗号,则
select SUBSTRING(ADDRESS from 1 for POSITION(',' in ADDRESS)-1) from T
应该可以。您可能还想 运行 通过 TRIM() 函数的结果以去除任何前导 and/or 尾随空格。