Re: How to remove duplicate lines but save one of the lines?

From: "Francisco Reyes" <lists(at)stringsutils(dot)com>
To: " A B " <gentosaker(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to remove duplicate lines but save one of the lines?
Date: 2008-07-21 15:43:13
Message-ID: f70a889ad5ab8c33dd2defc351f8c05a@stringsutils.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11:33 am 07/21/08 "A B" <gentosaker(at)gmail(dot)com> wrote:
> and I want it to be
> A 1
> B 3
> C 44

The slow way
select distinct field1, field2 from sometable.

The faster way
select field1,fields2 from sometable group by field1, field2.

Distinct should in theory be the same speed, but on several tests I have
done group by was faster. I posted a message to the list and there were
some explanations why group by was faster.. Hopefully someday they should
perform just as efficiently.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message A B 2008-07-21 15:51:07 Re: How to remove duplicate lines but save one of the lines?
Previous Message Said Ramirez 2008-07-21 15:42:06 Re: How to remove duplicate lines but save one of the lines?