Skip site navigation (1) Skip section navigation (2)

Subqueries

From: "Pascal Tufenkji" <ptufenkji(at)usj(dot)edu(dot)lb>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Subqueries
Date: 2008-10-30 12:17:34
Message-ID: 003e01c93a89$7eea61b0$150fa8c0@interne.usj.edu.lb (view raw or flat)
Thread:
Lists: pgsql-sql
Hello,

 

I don't understand the following error.

Can anyone help me plz

Thx

Pascal 

 

select *

from sip_vacations_v v

left join

(

      select pe.emp_id,mg.mat_id,mg.groupe,count(p.id) * 1.5 as nb_heures

      from mat_grp_v mg

      inner join planification_v p on p.mat_grp_id = mg.id

      inner join planification_ens_v pe on pe.planification_id = p.id

      where mg.annee_univ = v.annee and mg.semestre = v.sem_civ

      group by pe.emp_id,mg.mat_id,mg.groupe

) p on p.emp_id = v.emp_id

      and p.mat_id = v.mat_id

      and p.groupe = v.groupe

 

ERROR:  invalid reference to FROM-clause entry for table "v"

LINE 9: where mg.annee_univ = v.annee and mg.semestre = v.sem_civ

                              ^

HINT:  There is an entry for table "v", but it cannot be referenced from
this part of the query.

 

 

 

Responses

pgsql-sql by date

Next:From: Oliveiros CristinaDate: 2008-10-30 12:49:49
Subject: Re: Subqueries
Previous:From: gherzigDate: 2008-10-30 10:28:44
Subject: Re: trying to repair a bad header block

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group