Re: union query returning duplicates

From: Alvaro Herrera Munoz <alvherre(at)dcc(dot)uchile(dot)cl>
To: Sim Zacks <sim(at)compulab(dot)co(dot)il>
Cc: pgsql-general(at)postgresql(dot)org, Hagen Hoepfner <Hagen(dot)Hoepfner(at)gmx(dot)de>
Subject: Re: union query returning duplicates
Date: 2004-10-20 12:52:26
Message-ID: 20041020125226.GA28375@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Oct 20, 2004 at 01:54:04PM +0200, Sim Zacks wrote:
> It is very weird, I just tried both a group by and distinct and both
> of them still return the duplicates.
>
> I also tried a very simple union which didn't return any duplicates,
> both of these said, it is obviously not a problem with union.

Not related to your underlying problem, but be aware that UNION does
eliminate duplicates by design, so that could explain what you are seeing
here. If you don't want it to do that, use UNION ALL instead (the same
applies to INTERSECT and EXCEPT if you ever happen to use them).

--
Alvaro Herrera (<alvherre[(at)]dcc(dot)uchile(dot)cl>)
"Saca el libro que tu religión considere como el indicado para encontrar la
oración que traiga paz a tu alma. Luego rebootea el computador
y ve si funciona" (Carlos Duclós)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Josh Close 2004-10-20 13:25:22 Re: how much ram do i give postgres?
Previous Message Sim Zacks 2004-10-20 12:14:41 Re: union query returning duplicates