我正在学习MYSQL并且我得到了错误
字段列表中的未知列event_id
但是我在两个表中都有这个列
SELECT
event_id.events,
tournament.events,
team1.events,
team2.events,event_date.events,
venue.events, picks.pick,tournament.picks
FROM events
INNER JOIN picks
ON `event_id`.events = `event_id`.picks
WHERE tournament = 'SUPER15'
我已经检查过并进行了调整并尝试过,但我无法弄清楚出了什么问题......
表事件
表格选择
答案 0 :(得分:3)
首先应该是表名或别名,而不是列名,如下所示
SELECT
events.event_id,
events.tournament,
events.team1,
events.team2,
events.event_date,
events.venue,
picks.pick,
picks.tournament
FROM events
INNER JOIN picks ON
events.`event_id` = picks.`event_id`
WHERE
events.tournament = 'SUPER15'
您还必须为条件WHERE tournament = 'SUPER15'
添加列名。我将其更改为WHERE events.tournament = 'SUPER15'
。我还建议你使用如下的别名
SELECT
E.event_id,
E.tournament,
E.team1,
E.team2,
E.event_date,
E.venue,
P.pick,
P.tournament
FROM events E
INNER JOIN picks P ON
E.`event_id` = P.`event_id`
WHERE
E.tournament = 'SUPER15'
它更具可读性,不是吗?
答案 1 :(得分:0)
您以相反的顺序指定您的选择。它应该是onPostExecute
:
table.column