Re: [GENERAL] Simple OUTER JOIN doubt

2006-10-27 Thread Sandro Dentella
On Fri, Oct 27, 2006 at 04:22:36PM -0500, Russ Brown wrote: > Sandro Dentella wrote: > > On Fri, Oct 27, 2006 at 02:42:06PM -0500, Russ Brown wrote: > >> Looks to me like it is because you're referencing vota_punteggio in the > >> WHERE clause. > >> > >> Try something like this: > >> > >>SE

Re: [GENERAL] Simple OUTER JOIN doubt

2006-10-27 Thread Russ Brown
Sandro Dentella wrote: > On Fri, Oct 27, 2006 at 02:42:06PM -0500, Russ Brown wrote: >> Looks to me like it is because you're referencing vota_punteggio in the >> WHERE clause. >> >> Try something like this: >> >>SELECT f.id, f.titolo, p.voto >>FROM film_film f >>LEFT OUTER

Re: [GENERAL] Simple OUTER JOIN doubt

2006-10-27 Thread Tom Lane
Sandro Dentella <[EMAIL PROTECTED]> writes: > this works in fact, and it's simpler. But I don't really understard why I > should put it in this way. The other way seems to work for me: regression=# create table film_film (id int, titolo text); CREATE TABLE regression=# create table vota_punteggio

Re: [GENERAL] Simple OUTER JOIN doubt

2006-10-27 Thread Sandro Dentella
On Fri, Oct 27, 2006 at 02:42:06PM -0500, Russ Brown wrote: > Looks to me like it is because you're referencing vota_punteggio in the > WHERE clause. > > Try something like this: > >SELECT f.id, f.titolo, p.voto >FROM film_film f >LEFT OUTER JOIN vota_punteggio p >

Re: [GENERAL] Simple OUTER JOIN doubt

2006-10-27 Thread Tom Lane
Sandro Dentella <[EMAIL PROTECTED]> writes: > I only get films for which a vote was expressed. My query: >SELECT f.id, f.titolo, p.voto >FROM film_film f >LEFT OUTER JOIN vota_punteggio p >ON (f.id = p.film_id) >WHERE >(p.user_id = 2 OR p.user_id IS

Re: [GENERAL] Simple OUTER JOIN doubt

2006-10-27 Thread Russ Brown
Sandro Dentella wrote: > I've a very simple task. I thought I knew how to solve it but there's > something I'm surely missing. > > I got film and scores for the film. In table "film" and "punteggio" > (score). I want a join returning all the films and the votes > expressed by the user(s). If the