2
是否可以創建一個生成以下SQL的類型化查詢?INNER JOIN的鍵入查詢(SELECT DISTINCT)?
SELECT A.*
FROM schema1.Table1 A
INNER JOIN (SELECT DISTINCT column1, column2 FROM schema1.Table2) B ON A.column1 = B.column1
是否可以創建一個生成以下SQL的類型化查詢?INNER JOIN的鍵入查詢(SELECT DISTINCT)?
SELECT A.*
FROM schema1.Table1 A
INNER JOIN (SELECT DISTINCT column1, column2 FROM schema1.Table2) B ON A.column1 = B.column1
你不能加入一個子與一個類型的API選擇,最簡單的方式來實現,這將是使用CustomJoin
,e.g:
var table1 = db.GetTableName<Table1>();
var q = db.From<Table1>()
.CustomJoin([email protected]"INNER JOIN
(SELECT DISTINCT column1, column2 FROM schema1.Table2) B
ON {table1}.column1 = B.column1");
優秀的,謝謝! –