problem with distinct not distincting...

From: John Beynon <john(at)kyan(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: problem with distinct not distincting...
Date: 2012-10-17 10:48:22
Message-ID: CABvXOHpNO4rpC+b1EVC6SQstp3rCDZ3+WcCWMqcPvytKOxbw0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a pretty basic query;

select distinct on (name) name, length(name) from
drugs
where customer_id IS NOT NULL
order by name;

which I'd expect to only return me a single drug name if there are
duplicates, yet I get

name | length
==========
Roaccutane | 10
Roaccutane | 10

table encoding is UTF8...

I'm scratching my head!

Thanks,

John.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2012-10-17 10:49:35 Re: PostgreSQL Magazine
Previous Message Fathi Ben Nasr 2012-10-17 10:35:22 PostgreSQL Magazine