我目前运行查询:
select table1.columnA as Barrier_1,
table2.columnB as Action_1,
from table2
join table1 on table2.PrimKey = table1.PrimKey
where table1.columnA is not null
and table2.columnB is not null
group by table1.columnA, table2.columnB
order by table1.columnA
返回表:
Barrier_1 Action_1
____________________
01 | 01
01 | 02
02 | 01
02 | 03
02 | 04
03 | 02
03 | 03
04 | 01
05 | 04
我还想运行一个我不知道该怎么做的子查询。我需要同时利用屏障代码和操作代码从另一个表(tableC)中获取唯一值。因此,对于我在上面显示的每一行,都会有另一个名为“Desc”的字段从 tableC 返回:
Barrier_1 Action_1 Desc
______________________________
01 | 01 | 15
01 | 02 | 21
02 | 01 | 17
02 | 03 | 12
02 | 04 | 19
03 | 02 | 26
03 | 03 | 13
04 | 01 | 22
05 | 04 | 14