select * from csdn_a;
col1 col2
A 1
B 2
C 3
select * from csdn_b;
COL1 COL2
a1 A
a2 A
a3 A
b1 B
b2 B
b3 B
c1 C
c2 C
c3 C
select c1||c2||c3 as col from
(select b.col1 c1 from csdn_a a,csdn_b b where a.col2=1 and a.col1=b.col2) a,
(select b.col1 c2 from csdn_a a,csdn_b b where a.col2=2 and a.col1=b.col2) b,
(select b.col1 c3 from csdn_a a,csdn_b b where a.col2=3 and a.col1=b.col2) c
order by col;
a1b1c1
a1b1c2
a1b1c3
a1b2c1
a1b2c2
a1b2c3
a1b3c1
a1b3c2
a1b3c3
a2b1c1
a2b1c2
a2b1c3
a2b2c1
a2b2c2
a2b2c3
a2b3c1
a2b3c2
a2b3c3
a3b1c1
a3b1c2
a3b1c3
a3b2c1
a3b2c2
a3b2c3
a3b3c1
a3b3c2
a3b3c3
col1 col2
A 1
B 2
C 3
select * from csdn_b;
COL1 COL2
a1 A
a2 A
a3 A
b1 B
b2 B
b3 B
c1 C
c2 C
c3 C
select c1||c2||c3 as col from
(select b.col1 c1 from csdn_a a,csdn_b b where a.col2=1 and a.col1=b.col2) a,
(select b.col1 c2 from csdn_a a,csdn_b b where a.col2=2 and a.col1=b.col2) b,
(select b.col1 c3 from csdn_a a,csdn_b b where a.col2=3 and a.col1=b.col2) c
order by col;
a1b1c1
a1b1c2
a1b1c3
a1b2c1
a1b2c2
a1b2c3
a1b3c1
a1b3c2
a1b3c3
a2b1c1
a2b1c2
a2b1c3
a2b2c1
a2b2c2
a2b2c3
a2b3c1
a2b3c2
a2b3c3
a3b1c1
a3b1c2
a3b1c3
a3b2c1
a3b2c2
a3b2c3
a3b3c1
a3b3c2
a3b3c3
select 名称 名称a from 表2 where 外键字段 = 'a') a,
(select 名称 名称b from 表2 where 外键字段 = 'b') b,
(select 名称 名称c from 表2 where 外键字段 = 'c') c
order by 名称a