Re: Using AND in query - Mailing list pgsql-general

From John R Pierce
Subject Re: Using AND in query
Date
Msg-id 4C5E70F7.3010102@hogranch.com
Whole thread Raw
In response to Re: Using AND in query  (Thomas Kellerer <spam_eater@gmx.net>)
Responses Re: Using AND in query  (David Fetter <david@fetter.org>)
List pgsql-general
>
> The condition
>
>    and table.item = 'laptop' and table.item = 'Desktop'
>
> says: I want all rows where the column item has the value 'Laptop' and
> *at the same time* has the value 'Desktop'
> Which clearly cannot be the case (a column can only have a single value)
>
> So you need to join all "Laptop" rows to all "Desktop" rows to get
> what you want.

why not use OR ?

    ...  AND (table.item = 'laptop' OR table.item='Desktop') ...



pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Using AND in query
Next
From: Thomas Kellerer
Date:
Subject: Re: Using AND in query