Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Subquery uses ungrouped column - Mailing list pgsql-general

From Alex Ignatov
Subject Subquery uses ungrouped column
Date
Msg-id 68c84834-70a5-a707-d74a-e0cde953d470@postgrespro.ru
Whole thread Raw
Responses Re: Subquery uses ungrouped column
List pgsql-general

Hello!

Why the following query:

SELECT (select msc_id
              from collectors
              where id = substring(fileid from -1)
       ) msc_id
       from ip_data_records
       group by substring(fileid from -1)

gives me:

ERROR:  subquery uses ungrouped column "ip_data_records.fileid" from outer query
LINE 3:         where id = substring(fileid from -1)

but  the following query:

SELECT (select msc_id
              from collectors
              where id = fileid
       ) msc_id
       from ip_data_records
       group by fileid is working ok?

-- 
Alex Ignatov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

pgsql-general by date:

Previous
From: Thomas Güttler
Date:
Subject: Re: Do docs miss information about timing of triggers?
Next
From: "David G. Johnston"
Date:
Subject: Re: Subquery uses ungrouped column