我正在尝试加入:

select * from employee inner join order on employee.employeeid = order.EmployeeId


但是这个词
订购
我认为列的名称是order by,它没有引用该列。遇到此类问题时,如何在SQLite中进行?

最佳答案

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"

10-08 07:34
查看更多