2
我想在我的sql查詢中做幾個JOINS,但遇到了問題。我需要做的是從poker_sites
表中選擇所有字段,然後從networks
搶2個相關領域和(如果可用)獲得的平均評分editor_content
SQL JOIN多表&獲取AVG
我遇到的問題是查詢僅返回一行時,有應該至少有三個。
任何幫助將不勝感激。
這裏是我的SQL
SELECT AVG(editor_content.rating) AS rating, poker_sites.*,
networks.network_name, networks.network_icon FROM poker_sites
LEFT JOIN networks
ON (poker_sites.network_id=networks.network_id)
LEFT JOIN editor_content
ON (poker_sites.site_id=editor_content.assign_id)
WHERE poker_sites.published=1