您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

sql 字符串连接函数

2024/5/12 13:04:09发布33次查看
sql 字符串连接函数在sql中字符串连接函数我们学用到concat()来,concat() 的语法如下:concat(字串1, 字串2, 字串3, ...): 将字串1、字串2、字串3,等字串连在一起
sql 字符串连接函数在sql中字符串连接函数我们学用到concat()来,concat() 的语法如下:concat(字串1, 字串2, 字串3, ...): 将字串1、字串2、字串3,等字串连在一起。请注意,oracle的concat()只允许两个参数;换言之,一次只能将两个字串串连起来。不过,在oracle中,我们可以用'||'来一次串连多个字串。
select region_name + ' ' + store_name from geography
where store_name = 'boston';  
实例方法
a:
id value
1 111111111
2 222222222
3 333333333
表 b:
id data
9 11-11111-11
10 22-22222-22
11 33-33333-33
select * from a where substring(value,1,2) + '-' + substring(value,3,5) + '-' + substring(value,8,2)
not in (select b from data);
方法二
select *
from a
where (substr(value, 0, 2) || '-' || substr(value, 2, 5) || '-' ||
substr(value, 8, 9)) not in (select b from data);
或者直接更新value
update a set value=(substr(value, 0, 2) || '-' || substr(value, 2, 5) || '-' ||
substr(value, 8, 9));
如果不是oracle 的话substr 换成substring ,||换成+
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product