 begin    declare @OperatingCashflow0 int    declare @OperatingCashflow0 int    declare @result0 int     select @OperatingCashflow0 = AVG(hpd.TotalCashFromOperations)    from HistoricalFinPerformanceDataStagingGlobal hpd    where hpd.companyid = @companyid     select @OperatingCashflow0 = AVG(hpd.TotalCashFromOperations)    from (      select top (0) hpd.TotalCashFromOperations       from   HistoricalFinPerformanceDataStagingGlobal hpd       where hpd.companyid = @companyid    ) 