Search Postgresql Archives

Re: problem with distinct not distincting...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 17, 2012 at 5:48 AM, John Beynon <john@xxxxxxxx> wrote:
> 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!

as a sanity check, try:

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

merlin


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux