Re: distinct

From: bmccoy(at)chapelperilous(dot)net
To: andrew(at)networkcomputerz(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: distinct
Date: 2000-10-10 01:47:13
Message-ID: Pine.LNX.4.10.10010092145010.4175-100000@chapelperilous.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 3 Oct 2000 andrew(at)networkcomputerz(dot)com wrote:

> I have attempted to run
> select distinct col1 from tablename;
> and it runs fine.
>
> When I run it in a real world environment: select distinct col1, col2,
> col3, col4 from tablename order by col1 desc, col2; It returns all the
> values from col1 which appears to be the same thing as not using
> distinct at all.

The DISTINCT constraint applies to all of the columns you are selecting,
not just the first one -- it selects all of the distinct TUPLES from the
query.

Brett W. McCoy
http://www.chapelperilous.net
---------------------------------------------------------------------------
The Kennedy Constant:
Don't get mad -- get even.

In response to

  • distinct at 2000-10-03 21:11:51 from andrew

Browse pgsql-general by date

  From Date Subject
Next Message bmccoy 2000-10-10 01:56:41 Re: problems in compiling
Previous Message Hiroshi Inoue 2000-10-10 01:42:36 Re: Checking number of entries