+ -
当前位置:首页 → 问答吧 → 怎么写这个sql语句?

怎么写这个sql语句?

时间:2011-10-26

来源:互联网

A表里aa字段的值是'a123',B表里bb字段的值是'a123,b456'或者'c789,d123'

怎么写一个sql,取出A表里aa字段的值包含在B表里的bb字段中的所有记录

作者: charlesxu   发布时间: 2011-10-26

SQL code

select * from a, b
 where instr(',' || b.字段 || ',', 
             ',' || a.字段 || ',' ) > 0;


作者: opps_zhou   发布时间: 2011-10-26

SQL code
select * from a, b
 where instr(',' || b.字段 || ',', 
             ',' || a.字段 || ',' ) > 0;

作者: cosio   发布时间: 2011-10-26