如何创建两个子查询并添加计数以与属性进行比较?
这是我已经走了多远
Client clientAlias = null;
var subquery1 = QueryOver.Of<Car>()
.Where(c => c.Client.Id == clientAlias.Id)
.Where(c => c.Status == "Available");
var subquery1 = QueryOver.Of<Appartment>()
.Where(a => a.Client.Id == clientAlias.Id)
.Where(a => a.Size < 10);
var query = session.QueryOver<Client>(() => clientAlias);
这是如何在sql
中完成的select *
from Client c
where (select count(*) from [Car] r where r.ClientId = c.Id and r.Status = 'Available') + (select count(*) from [Appartment] a where a.ClientId = c.Id and a.Size < 10) > c.Age