我正在使用 SqlKata 为 SqlLite 创建 Db 查询。
var compiler = new SqliteCompiler();
var result = compiler.Compile(query);
var query = new Query()
.Select("client.Id")
.From("schema.client as c")
.Join("schema.order as o", "c.Id", "o.ClientId")
.WhereIn("c.Id", new[] {1,2,3});
预期的 sql 应该是:
SELECT client.Id FROM "schema.client" AS c
INNER JOIN "schema.order" AS o ON c.Id = o.ClientId
WHERE c.Id IN (1,2,3)
但我得到:
SELECT "client"."Id" FROM "schema"."client" AS c
INNER JOIN "schema"."order" AS o ON "c"."Id" = "o"."ClientId"
WHERE "c"."Id" IN (1,2,3)
当我使用模式时,
schema.order
我不应该在查询中使用:“模式”。“订单”只有表名应该带有“”。例如它应该是:
WHERE c.Id
而不是:WHERE "c"."Id"
我想知道,如果我做错了什么。
非常感谢您的回答。