gpt4 book ai didi

mysql - 从具有相同 where 子句的多个表中进行选择

转载 作者:行者123 更新时间:2023-11-29 18:42:30 25 4
gpt4 key购买 nike

我收到错误:

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的行。

最佳答案

尝试:

$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());

关于mysql - 从具有相同 where 子句的多个表中进行选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44862447/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com