我遇到了未知子句错误,无法解决。我对SQL有点绿色,但并不完全绿色。这是我的代码。
SELECT tg.name, tg.current_amount, tg.priority, tgc.needed, tgh.date
FROM tb_goal tg, tb_goal_college tgc, tb_goal_home tgh
CROSS JOIN (
SELECT tgc.needed, tgc.id, tgc.goal_id
FROM tb_goal_college tgc, tb_goal tg
) AS T ON tg.id = T.id
我收到“ on子句”中的未知列tg,=。id的错误。
该列存在于tg中,我看不到问题。
请帮忙。
谢谢。
最佳答案
请尝试这个
SELECT tg.name, tg.current_amount, tg.priority, tgc.needed, tgh.date
FROM tb_goal_college tgc, tb_goal_home tgh ,tb_goal tg
CROSS JOIN (
SELECT tgc.needed, tgc.id, tgc.goal_id
FROM tb_goal_college tgc, tb_goal a
) AS T ON tg.id = T.id
关于mysql - 在表中找到列时未知列,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21008440/