Re: COUNT DISTINCT

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Eric Jain <jain(at)gmx(dot)net>
Cc: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: COUNT DISTINCT
Date: 2000-07-17 13:25:20
Message-ID: 200007171325.JAA00431@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

[ Charset ISO-8859-1 unsupported, converting... ]
> > Depending on what you want, you might be able to just get away with
> > using coalesce on each of them...
> >
> > select count (distinct ( coalesce(text(advert_no), 'NULL') ||
> > coalesce(text(pool_id), 'NULL' ) ) ) from redirect;
>
> Great... This works perfectly. A bit of a monster though :-)

Hey, we didn't design SQL, we just implement it. :-)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex Bolenok 2000-07-17 13:35:44 Re: urgent help on function/trigger
Previous Message Poul L. Christiansen 2000-07-17 13:17:44 Re: Trouble with RPM