在创建触发器iam时出现错误: 子查询返回的值超过1。当子查询遵循=,!=,<,<=,>,> =或将子查询用作表达式时,不允许这样做。
UPDATE rm
SET
rm.cost_sqft = isnull((
select case when (rm.rm_cat in ('8','NON-REPORT') and rm.space_fee = 'No') then '0' else rent_w.w*@rental_rate end
from @rental_weight as rent_w, bl, rm
where rm.main_contact=rent_w.space_type
and rm.description=rent_w.space_quality
and bl.cost_type = rent_w.campuse_cost
and bl.bl_id = rm.bl_id
),'0')
WHERE rm.bl_id=@bl_id
AND rm.fl_id=@fl_id
AND rm.rm_id=@rm_id
FETCH NEXT FROM rm_cost
INTO @bl_id, @fl_id, @rm_id
END