Redian新闻
>
another sql operation question
avatar
another sql operation question# Database - 数据库
c*o
1
have a huge dataset. dumped for 7 hours. unfortunatley, had a small mistake.
here is the problem.
col_1 is a string and col_2 is also a string but very similar to col_1. The
only difference is that col_2 has one or two more charactors than col_1. I
only need to keep the last one or two charators of col_2. How do I do it?
Here is an example:
I now have:
col_1 col_2
1string 1string1
2string 2string23
what I want:
col_1 col_2
1string
avatar
c*o
2
got this figured out myself. this is an easy one.
update tbl_a
set col_2 = (select replace(col_2, col_1, ''));

mistake.
The

【在 c*******o 的大作中提到】
: have a huge dataset. dumped for 7 hours. unfortunatley, had a small mistake.
: here is the problem.
: col_1 is a string and col_2 is also a string but very similar to col_1. The
: only difference is that col_2 has one or two more charactors than col_1. I
: only need to keep the last one or two charators of col_2. How do I do it?
: Here is an example:
: I now have:
: col_1 col_2
: 1string 1string1
: 2string 2string23

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。