SELECT * FROM "animalTbl"
INNER JOIN "deathTbl"
ON animalTbl.animalID = deathTbl.animalID;
这是我的代码,当我运行它时会出现这样的问题
ERROR: missing FROM-clause entry for table "animaltbl"
LINE 3: ON animalTbl.animalID = deathTbl.animalID;
^
SELECT * FROM "animalTbl"
INNER JOIN "deathTbl"
ON animalTbl.animalID = deathTbl.animalID;
这是我的代码,当我运行它时会出现这样的问题
ERROR: missing FROM-clause entry for table "animaltbl"
LINE 3: ON animalTbl.animalID = deathTbl.animalID;
^
您必须使用相同的区分大小写的表名或别名来限定列
尝试这个:
SELECT * FROM "animalTbl" a
INNER JOIN "deathTbl" d
ON a.animalID = d.animalID
postgres 中的对象名称通常不区分大小写,但使用双引号引用它们会强制区分大小写。假设该from
子句是正确的,您应该与您的符号一致,并在该on
子句中使用与from
andjoin
子句中相同的符号:
SELECT *
FROM "animalTbl"
INNER JOIN "deathTbl" ON "animalTbl".animalID = "deathTbl".animalID;
-- Here -----------------^---------^------------^--------^