select b.code, a.id from a a, b b where to_number(instr(a.list, b.code))>0
提高查询准确性: SELECT t2.code,t1.id FROM t1,t2 WHERE instr(t1.list||',',t2.code)>0 这样只不过根据上面得表的内容写的,还应该提高准确性: 表A改为: A LIST ID *1,*2,*3, 1 *2,*4, 2 *4,*5, 3SELECT t2.code,t1.id FROM t1,t2 WHERE instr('*'||t1.list,t2.code)>0
SELECT t2.code,t1.id FROM t1,t2
WHERE instr(t1.list||',',t2.code)>0
这样只不过根据上面得表的内容写的,还应该提高准确性:
表A改为:
A LIST ID
*1,*2,*3, 1
*2,*4, 2
*4,*5, 3SELECT t2.code,t1.id FROM t1,t2
WHERE instr('*'||t1.list,t2.code)>0