Riyan
Riyan

Reputation: 117

POSTGRESQL ERROR:more than one row returned by a subquery used as an expression

SELECT

  (SELECT vch_message
     FROM TABLE1
       WHERE  vch_message like 'DONE%'
    ) as Status,
 (SELECT vch_Type
     FROM TABLE2
       WHERE  vch_Type like 'Account'
    ) as Type

From Table3
where Condition

Upvotes: 1

Views: 821

Answers (1)

Youcef LAIDANI
Youcef LAIDANI

Reputation: 59960

Why not :

SELECT
   Status.vch_message,
   Type.vch_Type 
From
   Table3,
   (
      SELECT
         vch_message 
      FROM
         TABLE1 
      WHERE
         vch_message like 'DONE%' 
   )
   as Status,
   (
      SELECT
         vch_Type 
      FROM
         TABLE2 
      WHERE
         vch_Type like 'Account' 
   )
   as Type 
WHERE
   Condition

Upvotes: 2

Related Questions