str_aggr function not wokring

From: aditya desai <admad123(at)gmail(dot)com>
To: Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: str_aggr function not wokring
Date: 2021-04-08 11:31:38
Message-ID: CAN0SRDHivv3kOFYcgvQv647F4O5PuKkRJwemm5hesZO75Q=Wjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,
I need to combine results of multiple rows in one row. I get below error.
Could you please help.

Query:

select string_agg((select '******' || P.PhaseName || ' - ' ||
R.Recommendation AS "ABC" from tblAssessmentRecommendation
R,tblAssessmentPhases P
where R.PhaseID = P.PhaseID Order BY P.sortOrder DESC),' ')

Error:

ERROR: more than one row returned by a subquery used as an expression SQL
state: 21000

Regards,
Aditya.

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Hervé Schweitzer (HER) 2021-04-08 11:40:19 Re: procedure using CURSOR to insert is extremely slow
Previous Message Szalontai Zoltán 2021-04-08 11:24:00 procedure using CURSOR to insert is extremely slow