Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Reference Manual]

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: sferac(at)proxy(dot)bazzanese(dot)com (Jose' Soares Da Silva)
Cc: pgsql-hackers(at)postgreSQL(dot)org, pgsql-docs(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Reference Manual]
Date: 1998-03-30 15:25:03
Message-ID: 199803301525.KAA13181@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
> 2. - Seems that optional ALL keyword of UNION doesn't work.
>      The following query prints always the same result with and without
>      the ALL clause.
> 
> *    UNION of two tables:
> 
> mytable:            yourtable:
>          id|name               id|name
>          --+------             --+------
>           1|Smith               1|Soares
>           2|Jones               2|Panini
>           3|Soares
> 
> 
> SELECT mytable.id, mytable.name
> FROM mytable
> WHERE mytable.name LIKE 'S%'
>    UNION
>        SELECT yourtable.id, yourtable.name
>        FROM yourtable
>        WHERE yourtable.name LIKE 'S%';
> 
> this is the result even if I don't specify ALL.
>                      id|name
>                      --+------
>                       1|Smith
>                       1|Soares
>                       3|Soares

The second column is duplicate, but the first is not.  It looks at all
columns to determine duplicates.

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

In response to

pgsql-hackers by date

Next:From: Thomas G. LockhartDate: 1998-03-30 16:17:17
Subject: Re: [DOCS] Reference Manual
Previous:From: Jose' Soares Da SilvaDate: 1998-03-30 15:19:05
Subject: Reference Manual

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group