问题
Is it possible to do sub-query join using ServiceStack's OrmLite?
Something like this?
var q = Db.From<Customer>()
.Join<Customer, subq>((c, subq) => c.CustomerID == subq.CustomerID)
回答1:
There's no Typed API support for joining on a sub select but you can use a CustomJoin
to do this, e.g:
var q = Db.From<Customer>()
.CustomJoin("INNER JOIN (SELECT Id FROM ...) sub ON sub.Id = Customer.Id")
来源:https://stackoverflow.com/questions/44899741/is-it-possible-to-do-sub-query-join-using-servicestacks-ormlite