想求出b表的aid字段对应a表的aid,已知b表中每条aid只对应a表中的一条记录,如下sql会报无效数字的错误:
select b.*, (select distinct aid from a where a.aid in (b.aid)) from b
...全文
852打赏收藏
求sql语句写法
a表 aid (int型) 34 35 36 b表 bid aid(varchar2(50)) 1 34 2 34,35 3 36 想求出b表的aid字段对应a表的aid,已知b表中每条aid只对应a表中的一条记录,如下sql会报无效数字的错误: select b.*, (select distinct aid from a where a.aid in (b.aid)) from b