Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
SQL
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,
Posted
Updated 7-Jan-12 1:04am
v2

1 solution

i ve solved myself ,it was my mistake only


set @MonthName = (select left(datename(month, ReviewDate), 3) as MonthName from CustomerReviews)

Problem is parameter when i changed this into the below, it working fine

set @MonthName = (select left(datename(month, getdate()), 3) as MonthName)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900