Is it possible to do sub-query join using ServiceStack's OrmLite?

五迷三道 提交于 2019-12-11 06:33:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!