使用 SQL KATA 进行自联接的正确方法是什么?目前,我只能执行以下操作
var query1 = new Query("Users");
var query = new Query("Users")
.Join(query1.As("a"), j => j.On("a.Name", "Users.ParentName"))
.Where("Name", "Sami");
但这会生成以下查询
SELECT
*
FROM
[Users]
INNER JOIN (
SELECT
*
FROM
[Users]
) AS [a] ON ([a].[Name] = [Users].[ParentName])
WHERE
[Name] = 'Sami'
是否可以实现以下查询?
SELECT
*
FROM
[Users] [a]
INNER JOIN [Users] [b] ON ([a].[ParentName] = [b].[Name])
WHERE
[a].[Name] = 'Sami'