表1 v1
id01 id02 id03 val name
101 201 301 123.00 aaaa
102 202 302 100.00 bbbb
103 203 303 145.00 cccc
100 205 306 56.00 kkkk
…… …… ……
表2 v2
id01 id02 id03 val de
101 205 301 256.00 123.00
101 202 303 246.00 123.00
102 202 302 456.00 789.00
103 201 303 789.00 123.00
100 205 306 100.00 89.00
…… …… …… ……
得到的结果:
id01 id02 id03 v1_val v1_name v2_val v2_de
102 202 302 100.00 bbbb 456.00 789.00
100 205 306 56.00 kkkk 100.00 89.00
…… …… …… ……
------解决方案--------------------
select a.id01, a.id02, a.id03, a.val , a.name
b.val , b.name from v1 a left join
v2 b on a.id01=b.id01 and a.id02=b.id02 and a.id03=b.id03
------解决方案--------------------
select a.id01, a.id02, a.id03, a.val v1_val, a.name v1_name, b.val v2_val, b.de v2_de
from v1 a, v2 b where a.id01=b.id01 and a.id02=b.id02 and a.id03=b.id03
------解决方案--------------------
select a.id01, a.id02, a.id03, a.val v1_val, a.name v1_name,
b.val v2_val, b.de v2_de from v1 a INNER JOIN
v2 b on a.id01=b.id01