i need to bind the chart using quality , service, delivery values ,in where am passing id year date but am getting
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
ALTER proc [dbo].[chartreview]
@RestaurantIndex_Id int,
@MonthName varchar(3)
as
begin
set @MonthName = (select left(datename(month, ReviewDate), 3) as MonthName from CustomerReviews)
IF (@MonthName ='Jan')
begin
select avg(QualityReview)as AVGQUALITY,avg(ServiceReview)as AVGSERVIC,
avg(DeliveryReview)as AVGDELIVERY,left(datename(month, ReviewDate), 3) As MON,month(ReviewDate) as Months
from CustomerReviews where RestaurantIndex_Id=@RestaurantIndex_Id
and month(ReviewDate) between 1 and 12
and year(ReviewDate)=year(getdate())-1
group by left(datename(month, ReviewDate), 3),month(ReviewDate) Order by month(ReviewDate)
end
else
begin
select avg(QualityReview)as AVGQUALITY,avg(ServiceReview)as AVGSERVIC,
avg(DeliveryReview)as AVGDELIVERY,left(datename(month, ReviewDate), 3) As MON,month(ReviewDate) as Months
from CustomerReviews where RestaurantIndex_Id=@RestaurantIndex_Id
and month(ReviewDate) between 1 and 12
and year(ReviewDate)=year(getdate())
group by left(datename(month, ReviewDate), 3),month(ReviewDate) Order by month(ReviewDate)
end
end
Please can somebody help me with this store procedure,