删除角色我都行, 例如:1,2,3,5,9,7
- >不是在(3,7) (这个字需要删除 - >结果选择1,2,5,9
如何做到这一点如何从列表
例如? :
drop table test.table_4;
create table test.table_4 (
id integer,
list_id text
);
insert into test.table_4 values(1,'1,2,3,5,9,7');
insert into test.table_4 values(2,'1,2,3,5');
insert into test.table_4 values(3,'7,9');
insert into test.table_4 values(5,'1,2');
insert into test.table_4 values(9,'1');
insert into test.table_4 values(7,'5,7,9');
查询:
select list_id from test.table_4 where id not in (3,7) --return 4 row
id list_id
1. 1 '1,2,3,5,9,7'
2. 2 '1,2,3,5'
3. 5 '1,2'
4. 9 '1'
如何在第1行删除3,7和2
id
1. 1 '1,2,5,9'
2. 2 '1,2,5'
3. 5 '1,2'
4. 9 '1'
你能建立一个sqlfiddle HTTP://sqlfiddle.com/ –
你问如何删除字符串中的任何'7'?还是你问如何删除最后一个字符?请澄清。 – Linger
@Linger或第一个字符不是为了^ ^。如此多的可能性。 – ShellFish