WITH split(word, str) AS ( -- alternatively put your query here -- SELECT '', category||',' FROM categories SELECT '', 'Auto,A,1234444,dsfdd,sd,sd'||',' UNION ALL SELECT substr(str, 0, instr(str, ',')), substr(str, instr(str, ',')+1
一.拆分字符串为若干行 例一:要求将表emp中的'king'按照每行一个单词拆成四行 注意:substr(str,pos):截取pos位置开始的字符: substr(str,pos,len):从pos位置开始,选出接下去的len个字符 表emp: eid ename 1 ring 2 king 3 ting 4 ping 首先,建立表tmp(基干表,为了配合表一使用): tid 1 2 3 4 5 然后,select emp.ename,tmp.tid from emp,tmp where em
1.连表子查询获取值 select bas.name,bas.id_card_num,bas.mobil_no,gender,bas.birthday,bas.height,bas.weight,province.value as province,city.value as city,area.value as area,profession.value as profession from xy_user_baseinf bas LEFT JOIN (select usr_no,`value
c++拆分字符串方法: #include <iostream>#include <string>#include <sstream>#include <algorithm>#include <iterator> int main() {using namespace std;string sentence = "Something in the way she moves...";istringstream iss(sente
在SQL中取出字符串中数字部分或在SQL中取出字符部分 编写人:CC阿爸 2013-10-18 近来在开发一个项目时,一包含数字的字符串,需要取出中间的数字部分进行排序.经过baidu搜索.并结合自己项目的需求,编写了一个自定义的SQL函数用供项目中使用. /****** Object: UserDefinedFunction [dbo].[F_Get_No] Script Date: 10/18/2013 22:03:13 ******/ SET ANSI_NULLS ON GO SET QU
1. // 根据字符串,拆分字符串,相当于vb中的split函数 function SplitString(const Source, ch: string): TStringList; var temp: String; i: Integer; begin Result := TStringList.Create; // 如果是空自符串则返回空列表 if Source = '' then exit; temp := Source; i := pos(ch, Source); while i <