From: | Ben <bench(at)silentmedia(dot)com> |
---|---|
To: | "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk> |
Cc: | PostgreSQL-General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Do I just not understand count()? |
Date: | 2002-04-08 20:04:54 |
Message-ID: | Pine.LNX.4.30.0204081303290.9115-100000@gilgamesh.eos.SilentMedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
This is the first time I've tried. I noticed that I could add a DISTINCT
clause to count(), and wondered why I couldn't add an equality and make it
work as well.
On Mon, 8 Apr 2002, Nigel J. Andrews wrote:
>
>
> Perhaps it would clear up things for those more expert on SQL [and it's
> variations across DBs] than I if you could say on what system you would
> normally do this.
>
>
> > > That's what I'd normally do to, but in this case I want to run a query
> > > more like
> > >
> > > select count(a=1), count(a=2) from t
> > >
> > > > > If I have the table t defined as:
> > > > >
> > > > > a
> > > > > ---
> > > > > 1
> > > > > 1
> > > > > 2
> > > > >
> > > > >
> > > > > and I say:
> > > > >
> > > > > select count(a=1) from t;
> > > > >
> > > > > should it give me 1 or 2 as a result? I'm getting 2, and I'd think I
> > > > > should get 1....
> > > > >
>
>
>
> --
> Nigel J. Andrews
> Director
>
> ---
> Logictree Systems Limited
> Computer Consultants
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Wood | 2002-04-08 20:06:01 | Re: vacuuming not working? |
Previous Message | Nigel J. Andrews | 2002-04-08 20:02:56 | Re: PHP, HTML Forms & PostgreSQL |