我被困在查詢,我想要顯示來自不同的表和他們的橋表的數據。
表是:sql加入進一步需要幫助
bridge (bid,planid,fbridgeid)
fbridge (fbridgeid,featureid,valueid)
features (featureid,fname)
value (valueid,value)
plans (planid,name,price,discount)
下面是到目前爲止我的查詢:
SELECT
(NAME AS pname, price AS prize,
discount AS ds, fname AS feature, VALUE AS vlue
FROM plans )
我想所有的數據庫列,但按照計劃
like planid 1 ->> contains ->> feature id 1,2,3 and valueid 1,3,5 etc)
非常感謝所有查詢的工作方式相同..但被重複數據..我也用'選擇P檔用組.name AS pname,p.price AS prize,p.discount AS ds,f.fname AS feature,v.value AS vlue FROM plans p INNER JOIN bridge b ON p.planid = b.planid INNER JOIN fbridge fb ON b.fbridgeid = fb.fbridgeid INNER JOIN功能F於fb.featureid = f.featureid INNER JOIN值V ON fb.valueid = v.valueid GROUP BY pname' –
結果:'PNAME獎品DS設有vlue
介質30 20 discspace 20GB 小20 15 bw 30gb' –