我是SQL新手,試圖爲6個表一起構建一個連接。這裏是我的示例代碼:MySQL中用於構建倍數的正確語法JOIN
SELECT cr.COMMUNICATIONS_ID, cr.CONSUMER_ID, cr.ACTION_LOG_ID, nc.CONSUMER_ID, cal.CONSUMER_ID, cal.TIPS_AMOUNT, cal.LAST_MOD_TIME, cirm.CONSUMER_RATING, ces.EXPERT_SCORE, cim.CONSUMER_INTEREST_EXPERT_ID, scs.SIMILARITY
FROM COMMUNICATION_RELVANCE AS cr
JOIN network_communications AS nc
ON cr.COMMUNICATIONS_ID=nc.COMMUNICATIONS_ID
JOIN consumer_action_log AS cal
ON cr.ACTION_LOG_ID=cal.ACTION_LOG_ID
JOIN communication_interest_mapping AS cim
ON cr.COMMUNICATIONS_ID=cim.COMMUNICATIONS_ID
JOIN consumer_interest_rating_mapping AS cirm
ON cr.CONSUMER_ID=cirm.CONSUMER_ID
AND cim.CONSUMER_INTEREST_EXPERT_ID=cirm.CONSUMER_INTEREST_ID
JOIN consumer_expert_score AS ces
ON nc.CONSUMER_ID=ces.CONSUMER_ID
AND cim.CONSUMER_INTEREST_EXPERT_ID=CONSUMER_EXPERT_ID
JOIN survey_customer_similarity AS scs
ON nc.CONSUMER_ID=scs.CONSUMER_ID
AND cal.CONSUMER_ID=scs.CONSUMER_ID;
在我開始調試之前,我想確保在我的代碼中沒有任何批發問題,我的語法。
執行查詢。然後你會看到是否有任何語法錯誤。如果我想檢查查詢語法錯誤,那我就會這麼做。 – Oswald 2011-01-24 21:06:01