我遇到了未知子句错误,无法弄明白。我对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子句'中收到了Unknown column tg,=。id的错误。
该列存在于tg中,我没有看到问题。
请帮忙。
谢谢。
答案 0 :(得分:0)
请试试这个
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