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