17,090
社区成员
发帖
与我相关
我的任务
分享
id ids
---------------------------
1 321,322,323,404,405
2 112,113,114,115,116,117
用拼接多行
select wm_concat(ids) as ids from b
id name
------------------------
321 xxx
322 ccc
114 bbb
用 select * from a where id in(select wm_concat(ids) as ids from b)
是不可行的,提示
ORA-01722: 无效数字
01722. 00000 - "invalid number"
select * from a,b where instr(b.ids,a.id) <> 0
查询结果:
a.id a.name b.id b.ids
321 xxx 1 321,322,323,404,405
322 ccc 1 321,322,323,404,405
114 bbb 2 112,113,114,115,116,117
select * from a where id in(select ids from b);
结果如下:
ORA-01722: 无效数字
01722. 00000 - "invalid number"
有说用to_number,但这个不知怎么用?
select * from a where id in(select ids from b);