我正在尝试加入:
select * from employee inner join order on employee.employeeid = order.EmployeeId
但是这个词
的 顺序
这个列的名称被认为是order by
我认为它并没有引用该列。如果遇到此类问题,如何在SQLite中继续?
答案 0 :(得分:1)
SQLite:正确转义表名和列名。使用双引号 列名,表名,触发器名等。
SELECT "column name", "my column", FROM "table name" //Use single quotes around string values SELECT * FROM "table name" WHERE "column name" = 'string value' //Use two double quotes if e.g. your column name contains a double quote
(例如我的“专栏”
SELECT "my""column" FROM "my""table"
https://blog.christosoft.de/2012/10/sqlite-escaping-table-acolumn-names/
所以请使用双引号:
select * from "employee" inner join "order" on employee.employeeid = "order"."EmployeeId"
答案 1 :(得分:1)
要解决此问题,您可以使用表别名。
select * from employee inner join order o on employee.employeeid = o.EmployeeId;
希望这会对你有所帮助。