嗨我想获得结果为每个以下查询到一个查询。我知道我可以做一个联盟,但我想知道是否有更好的方法,因为每个表都有不同的列?由于需要帮助写一个查询
select distinct RESOURCE_ID from USER_ROLES where TEST_IND ='Y'
select distinct RESOURCE_ID from USER_PLATFORMS where TEST_IND ='Y'
select distinct RESOURCE_ID from USER_COMPETENCIES where TEST_IND ='Y'
select distinct RESOURCE_ID from USER_TECH_SKILLS where TEST_IND ='Y'
select distinct RESOURCE_ID from USER_MGR_SKILLS where TEST_IND ='Y'
select distinct RESOURCE_ID from USER_APPS where TEST_IND ='Y'
select distinct RESOURCE_ID from BUS_PROCS where TEST_IND ='Y'
你想要输出看起来像什么?没有办法在每行都有不同列的情况下编写查询。 – JohnFx 2012-04-23 23:09:28
我认为UNION是最好的方式去... – 2012-04-23 23:10:21
而你正在寻找与许多列(RoleId,PlatformId,...)或许多行与一列的一行? – pilotcam 2012-04-23 23:12:00