我有這三個表:如何選擇符合連接表中定義條件的記錄?
products TABLE:
id:integer
name:string
features TABLE:
id:integer
name:string
features_products TABLE:
product_id:integer
feature_id:integer
的features_products TABLE
告訴我,其特點有每個產品。例如:
product_id feature_id
1 3
1 5
3 4
告訴我的產品1具有特徵3和5和產品3具有特徵4,另外,產物2(如果存在)不具有的特徵。
我的問題是,我怎樣才能SELECT
所有的產品從產品TABLE具有確定的功能?例如,SELECT products which have features 3 AND 5
,或SELECT products which have feature 2
features_products我編輯。謝謝。 – 2010-07-05 18:59:07