您当前的位置:首页 > 计算机 > 软件应用 > 数据库 > 其它

sqllite中实现字符串分割

时间:08-25来源:作者:点击数:
城东书院 www.cdsy.xyz

sqlite 从固定字符串分隔

WITH split(word, str) AS (
    -- alternatively put your query here
    -- SELECT '', category||',' FROM categories
    SELECT '', 'Auto,A,1234444,dsfdd,sd,sd,77'||','
    UNION ALL SELECT
    substr(str, 0, instr(str, ',')),
    substr(str, instr(str, ',')+1)
    FROM split WHERE str!=''
) SELECT word FROM split WHERE word!='';

sqlite 从表中获取数据

WITH split(word, str) AS (
    SELECT '', (select chi_sht from tr_map_org_basic where com_name_en='code cat' and status=1)||','
    UNION ALL SELECT
    substr(str, 0, instr(str, ',')),
    substr(str, instr(str, ',')+1)
    FROM split WHERE str!=''
) SELECT word FROM split WHERE word!='';

sqlite 从表中获取数据,union all 连接语句

WITH split(word, str) AS (
    SELECT '', (select chi_sht from tr_map_org_basic where com_name_en='code cat' and status=1)||','
    UNION ALL SELECT
    substr(str, 0, instr(str, ',')),
    substr(str, instr(str, ',')+1)
    FROM split WHERE str!=''
) SELECT word FROM split WHERE word!=''
union all select eng_sht from tr_map_org_basic where com_name_en='code cat';
城东书院 www.cdsy.xyz
方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门
本栏推荐