我必須從兩個表中查詢並希望得到一個結果..我如何加入這兩個查詢?加入兩個Oracle查詢
第一個查詢是從兩個表中查詢,第二個查詢只能從一個查詢。
select pt.id,pt.promorow,pt.promocolumn,pt.type,pt.image,pt.style,pt.quota_allowed,ptc.text,pq.quota_left
from promotables pt,promogroups pg ,promotablecontents ptc ,promoquotas pq where pt.id_promogroup = 1 and ptc.country ='049' and ptc.id_promotable = pt.id and pt.id_promogroup = pg.id and pq.id_promotable = pt.id order by pt.promorow,pt.promocolumn
select pt.id,pt.promorow,pt.promocolumn,pt.type,pt.image,pt.style,pt.quota_allowed from promotables pt where pt.type='heading'
你想加入查詢或將它們連接起來?這些在SQL中意味着不同的東西。連接通常意味着連接標準(從a.col = b.col'上的連接b中選擇),而連接只是將一個查詢的結果附加到另一個查詢(例如,通過'UNION'或'UNION ALL')。 – 2010-06-10 02:54:53