0
我有一個包含用於移動運營商的流行設備和品牌的數據庫。MySQL在一個簡單的數據庫上加入聲明
我想爲選擇最流行的MODELS for和account +品牌創建一個連接查詢;
SELECT m1.name FROM
models as m1
JOIN accounts_to_models as am1
ON m1.id = am1.FK_model_id
JOIN brands as br
on br.id = m1.FK_brand_id
JOIN accounts as ac
on ac.id = am1.FK_account_id
WHERE ac.name = "Operator" and b1.name = "HTC"
ORDER BY am1.priority desc limit 10
am1中沒有FK_brand_id,但是謝謝......! – user2988649 2014-09-03 17:37:46
@ user2988649。 。 。這是一個錯字。根據您原先在問題中提供的數據模型,它應該是'm1'。 – 2014-09-03 19:48:36