Replies: 1 comment 1 reply
-
WithSqlfsql.Select<Topic, Category, CategoryType>()
.WithSql(
"select * from Topic where id=@id1",
"select * from Category where id=@id2",
null, //不设置 CategoryType 对应的 SQL
new { id1 = 10, id2 = 11, id3 = 13 }
)
.LeftJoin((a,b,c) => a.CategoryId == b.Id)
.LeftJoin((a,b,c) => b.ParentId == c.Id)
.ToList();
//SELECT ...
//FROM ( select * from Topic where id=@id1 ) a
//LEFT JOIN ( select * from Category where id=@id2 ) b ON a.`CategoryId` = b.`Id`
//LEFT JOIN `CategoryType` c ON b.`ParentId` = c.`Id`
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
select a.*, b.Name from Table_A a left join Table_B b on a.WNO = b.WNO
inner join (select distinct a.SCID from Table_C a inner join Table_D b on a.RID = b.RID and b.WID = 1) c
on a.SCID = c.SCID
这样 需要先查询 再联表 在Freesql中应该如何实现
Beta Was this translation helpful? Give feedback.
All reactions