left join下select a.*,b.his_price1,b.his_price2,b.his_price3,b.his_price4 from flowers_sale a left join flower_sale_his b on a.flower_id=b.flower_id where a.flower_id=输入值 ;
用完全外连接啊,好象应该是ID和日期两个字段?select NVL(a.flower_id,b.flower_id) flower_id,NVL(a.date,b.date) date ,a.price1,a.price2,a.price3,b.his_price1,b.his_price2,b.his_price3,b.his_price4 from flowers_sale a full outer join flower_sale_his b on a.flower_id=b.flower_id and a.date=b.date order by 1,2
from flowers_sale a
left join flower_sale_his b on a.flower_id=b.flower_id
where a.flower_id=输入值
;
第三种情况表连接条件是flower_id, date, price1, price2, price3四个字段都要的吧,并且还是全连接
276773 2010-01-03 null null null 567 null 890 123
,a.price1,a.price2,a.price3,b.his_price1,b.his_price2,b.his_price3,b.his_price4
from flowers_sale a full outer join flower_sale_his b
on a.flower_id=b.flower_id and a.date=b.date
order by 1,2