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

Re: Left outer join with WHERE clause?

From: DI Hasenöhrl <i(dot)hasenoehrl(at)aon(dot)at>
To: <match(at)langille(dot)org>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Left outer join with WHERE clause?
Date: 2002-03-28 13:51:56
Message-ID: 003e01c1d65f$b9a01d80$01011eac@irina (view raw or flat)
Thread:
Lists: pgsql-sql
Thank you very much, for your advice, but something is still wrong, because it doesn't work.

I get the following message: parse error at or near "on"

I tried the Left Join with an easier query, but it still doesn't work. Maybe you see, what I'm making wrong
  select artikel.a_nr,artikel.a_bez1,artikel.a_bez2 from Artikel 
  LEFT JOIN (vartikellieferantbez ON (artikel.a_nr = vartikellieferantbez.a_nr AND vartikellieferantbez.f_nr=1 ));

Many thanks,
Irina
  ----- Original Message ----- 
  From: Dan Langille 
  To: DI Hasenöhrl 
  Cc: pgsql-sql(at)postgresql(dot)org 
  Sent: Thursday, March 28, 2002 2:10 PM
  Subject: Re: [SQL] Left outer join with WHERE clause?


  On 28 Mar 2002 at 13:58, DI Hasenöhrl wrote:

  > It doesn't work too:            LEFT JOIN (vartikellieferantbez ON
  > artikel.a_nr = vartikellieferantbez.a_nr WHERE
  > ((vartikellieferantbez.f_nr)=1) 

  Your "where" clause for an OUTER JOIN is actually the ON statement.  So do this:  

  LEFT JOIN (vartikellieferantbez ON (artikel.a_nr = vartikellieferantbez.a_nr  AND 
  vartikellieferantbez.f_nr = 1))  


In response to

Responses

pgsql-sql by date

Next:From: DI HasenöhrlDate: 2002-03-28 15:31:10
Subject: Re: Left outer join with WHERE clause?
Previous:From: Dan LangilleDate: 2002-03-28 13:21:52
Subject: Re: Left outer join with WHERE clause?

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