I have a stored procedure for returning data in one row with sub query,but i am getting a error that
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
I am providing you my stored procedure please check and give me solution.
CREATE proc [dbo].[GetChartDetails]
@type varchar(50)
as
begin
select
(select SUM(PaidAmt)as LifeInsurance, DATENAME(MONTH, CreateDate) Month_name from CutomerPaymentDetail where categorytype='LIFE INSURANCE' and type=@type group by DATENAME(MONTH, CreateDate)) ,
(select SUM(PaidAmt)as GIC ,DATENAME(MONTH, CreateDate) Month_name from CutomerPaymentDetail where categorytype='GIC' and type=@type group by DATENAME(MONTH, CreateDate)) ,
(select SUM(PaidAmt)as MutualFund ,DATENAME(MONTH, CreateDate) Month_name from CutomerPaymentDetail where categorytype='MUTUAL FUND' and type=@type group by DATENAME(MONTH, CreateDate))
end


Madan ShekarRank #428 · 5.9K reputationPosted Jun 24, 2019, 10:37 PM EDT
Suraj KumarRank #353 · 7.1K reputationPosted Jun 24, 2019, 10:55 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Jun 25, 2019, 7:33 PM EDT
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 14, 2019, 7:11 AM EST