两张表:
第一张表:
name groupId
11 100101
22 100102
33 100103
44 100104
55 100105
第二张表:
groupIdList name
;100102;100104;100105; 1
我要实现:
select name from 第一张表 where groupId in (select groupIdList from 第二张表 name=1)
相当于 select name from 第一张表 where groupId in (100102,100104,100105)
第一张表:
name groupId
11 100101
22 100102
33 100103
44 100104
55 100105
第二张表:
groupIdList name
;100102;100104;100105; 1
我要实现:
select name from 第一张表 where groupId in (select groupIdList from 第二张表 name=1)
相当于 select name from 第一张表 where groupId in (100102,100104,100105)
解决方案 »
- !!!紧急求救ORACLE高手,ORACLE中如何将数字转化为字符串
- oracle中关于for循环循环游标问题
- 关于数据泵的二次恢复问题
- 数据库导入导出问题
- 关于oracle上在两个不同机器上的数据库数据的导入问题
- 误删OracleOraDb11g_home1TNSListener,导致监听不能启动,怎么办啊?急。。。
- 关于动态分区的两个问题?
- ************数据库归档模式问题***************
- Windows的批处理问题,包含ftp操作
- 哪里能下到oracle8
- Oracle与插件DevExpress XtraTreeList兼容性问题
- 数据库服务器CPU使用率达到100%
from table1
where groupId in
(select regexp_substr(groupIdList, '[^;]+', 1, rownum)
from table2
where name = 1
connect by rownum <=
length(regexp_replace(groupIdList, '[^;]', null)))
from TAB_A a,
TAB_B b
where b.groupidlist like '%;'||a.gropid||';%'
and b.name=1
WITH TABA AS (SELECT '11' AS name, '100101' AS groupId FROM DUAL UNION
SELECT '22' AS name, '100102' AS groupId FROM DUAL UNION
SELECT '33' AS name, '100103' AS groupId FROM DUAL UNION
SELECT '44' AS name, '100104' AS groupId FROM DUAL UNION
SELECT '55' AS name, '100105' AS groupId FROM DUAL ),
TABB AS
(SELECT ';100102;100104;100105;' AS groupIdList, 1 AS NAME FROM DUAL)
SELECT TABA.* FROM TABA, TABB
WHERE TABB.NAME = 1
AND INSTR(TABB.groupIdList, ';' || TABA.GROUPId || ';') > 0
????
select a.name from 第一张表 a ,
(select groupIdList from 第二张表 name=1) b
where groupId = groupIdList