2017-07-01 164 views
0

我收到提示:從多個表中選擇具有相同的where子句

Column 'season' in where clause is ambiguous

,並不能找出如何解決它。

$fg_leader_id_query = mysql_query("SELECT * FROM stats_pd, stats_int, stats_ha, stats_ke, stats_ka, stats_kn, stats_lv, stats_sv, stats_snv WHERE `season`='".$season."' ORDER BY fgm/fga DESC LIMIT 1") or die(mysql_error()); 

我需要從列表季節等於$season的每個表中獲取行。

回答

0

嘗試:

$fg_leader_id_query = mysql_query(" 
SELECT * 
FROM stats_pd, stats_int, stats_ha, stats_ke, stats_ka, stats_kn, stats_lv, stats_sv, stats_snv 
WHERE 
     `stats_pd.season`='".$season." OR 
     `stats_int.season`='".$season." OR 
     `stats_ha.season`='".$season." OR 
     `stats_ke.season`='".$season." OR 
     `stats_ka.season`='".$season." OR 
     `stats_kn.season`='".$season." OR 
     `stats_lv.season`='".$season." OR 
     `stats_sv.season`='".$season." OR 
     `stats_snv.season`='".$season."' 
ORDER BY fgm/fga DESC LIMIT 1 
") or die(mysql_error()); 
相關問題