nested query problem

From: David Gauthier <davegauthierpg(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: nested query problem
Date: 2018-09-06 20:59:37
Message-ID: CAMBRECCCSqSRZnBz2--ShfaP9fhkJYMVu+zktj6CEuZuT6Ovww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi:

I'm having trouble with this query...

select sr.sqf_id, sr.status, fse.perl_sub_name, fse.end_datetime
from
sqf_runs sr,
(select perl_sub_name, end_datetime from flow_step_events_view where
sqf_id = sr.sqf_id order by 2 limit 1) fse
where sr.userid='foo';

ERROR: invalid reference to FROM-clause entry for table "sr"
LINE 4: ...atetime from flow_step_events_view where sqf_id = sr.sqf_id ...
^
HINT: There is an entry for table "sr", but it cannot be referenced from
this part of the query.

If this is indeed a foul, how can I accomplish the same thing ?

Thanks in Advance !

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Jungwirth 2018-09-06 21:10:10 Re: nested query problem
Previous Message Adam Brusselback 2018-09-06 15:57:23 Re: Re: How to install pgAgent on windows for postresql-bigsql-10.5