表1 列 code ,name ,cerl
表2 列 code ,bmound ,flag
结果
cerl bmound flag
表1,2 的code 都不是唯一值
相当于表2的所有值都查出来,通过code 把表1的cerl对应增加在表新列2上。
表2 列 code ,bmound ,flag
结果
cerl bmound flag
表1,2 的code 都不是唯一值
相当于表2的所有值都查出来,通过code 把表1的cerl对应增加在表新列2上。
B表是表2
from 表1 a,表2 b
where a.code = b.code
查出来的b.mound还是错了的。要得结果是b.bmound是表2的数据,只是在表2里面添加一个列这个列,这个列是表1过来调过来的
code 不是唯一值,返回的数据错误
from 表2
left join 表1
on 表2.code = 表1.code
FROM 表2
LEFT OUTER JOIN 表1
ON 表2.code = 表1.code
from
(select * from 表2 group by code,bmound,flag) as b --避免多对多
left join 表1 as a
on b.code=a.code