2
votes

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

1 Answers

3
votes

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")