Re: difference between UNION operator and OR in where clause

From: Mike <gongweigang_at_gmail.com>
Date: Tue, 10 Jul 2007 10:44:18 -0700
Message-ID: <1184089458.256104.243140_at_d55g2000hsg.googlegroups.com>


On Jul 10, 1:19 pm, Lennart <erik.lennart.jons..._at_gmail.com> wrote:
> Mike wrote:
>
> [...]
>
> > 3 t-3
> > 2 d-2
> > 3 d-3 FALSE
>
> I'll remove all columns but pubid, can you describe why you think this
> evaluates to FALSE?
>
> publication.pubid book.pubid journal.pubic
> 3 2 3
>
> /Lennart

Ops. I think there is a mistake in my previous output.

Anyway, after removing all columns except the pubid.

The cross product will be:

publication.pubid book.pubid journal.pubid where

        1                      1                 3             TRUE
        1                      2                 3             FALSE
        2                      1                 3             FALSE
        2                      2                 3             TRUE
        3                      1                 3             TRUE
        3                      2                 3             TRUE


Therefore, 4 records are TRUE.

So using solution 2, it will output 4 titles, whereas the correct one should be 3 titles.

However, if using solution 2 with "select DISTINCT", it will output 3 titles instead. Received on Tue Jul 10 2007 - 19:44:18 CEST

Original text of this message