这是示例实现之一,而不是原始代码..这个问题可能是旧问题但想了解基础知识..这里返回类型被指定为IEnumerable但实际上我们在这里返回一个List ..
因此,如果我们返回List,那么我们可以将方法返回类型也作为List .. rit?
select
of.building_id as Building_Id,
(
select name from organization_building ob
where ob.id = of.building_id
) as Building_Name,
count(distinct of.id) as Floors_Total,
count(distinct of.id) -
count(distinct
case when oe.end < ?start? and oe.start > ?end?
then of.id else null end
) as Floors_Available
from
organization_floor of
left outer join
organization_event oe
on oe.calendar_id = of.calendar_id
group by
of.building_id
这是WebAPI中的示例方法之一