Re: Problem with JOINS

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Charlie Clark <charlie(at)begeistert(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Problem with JOINS
Date: 2004-05-21 15:05:28
Message-ID: 3687.1085151928@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Charlie Clark <charlie(at)begeistert(dot)org> writes:
> WHERE true
> AND
> person.id_status = 2
> AND
> person.id_authorise = 2
> AND
> ltrim(lower(address.ort)) like lower('Neuss%')
> AND
> bs.value = 'bezahlt' OR bs.value = 'erlassen'
> AND
> users.roles like '%Premium'

AND binds more tightly than OR --- I suspect you wanted some
parentheses.

AND
(bs.value = 'bezahlt' OR bs.value = 'erlassen')
AND

Or you could express the same thing using IN:

AND
bs.value IN ('bezahlt', 'erlassen')
AND

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-05-21 15:28:52 Re: Preventing Deletions with triggers
Previous Message Manuel Sugawara 2004-05-21 15:01:20 Re: Preventing Deletions with triggers