Olaf Marc Zanger wrote:
>hi there,
>
>i want to add up the "true" values of a comparison like
>
>sum(a>b)
>
>it just doesn't work like this
>
>any workaround?
select count(*) where a > b;
--
Oliver Elphick[EMAIL PROTECTED]
Isle of Wight
Thus spake J.Fernando Moyano
> El Viernes 23 Febrero 2001 16:22, escribiste:
> > i want to add up the "true" values of a comparison like
> >
> > sum(a>b)
> >
> > it just doesn't work like this
> >
> > any workaround?
>
> I did exactly the same thing two months ago
>
> I created this tiny fu
El Viernes 23 Febrero 2001 16:22, escribiste:
> hi there,
>
> i want to add up the "true" values of a comparison like
>
> sum(a>b)
>
> it just doesn't work like this
>
> any workaround?
>
> it is postgresql 7.0 under linux
>
> thanks
>
> olaf
I did exactly the same thing two months ago
I c
hi there,
i want to add up the "true" values of a comparison like
sum(a>b)
it just doesn't work like this
any workaround?
it is postgresql 7.0 under linux
thanks
olaf
--
soli-con Engineering Zanger, Dipl.-Ing. (FH) Olaf Marc Zanger
Lorrainestrasse 23, 3013 Bern / Switzerland
fon:+41-31-
Or how about just:
SELECT count(*) FROM tablename WHERE a > b;
--
Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology
Chapel Hill, North Carolina, USA - http://demog.berkeley.edu/~aperrin
[EMAIL PROTECTE
hi there,
s cool,
this works streight away and took 5 min. waiting for a answer :-)
thanks very much to you tod personal and the mailing list for existence.
Olaf
Tod McQuillin schrieb:
>
> On Fri, 23 Feb 2001, Olaf Zanger wrote:
>
> > i'd like to add up the "true" values of a comparison
Olaf Zanger writes:
> i'd like to add up the "true" values of a comparison like
>
> sum(a>b)
sum(case when a>b then 1 else 0 end)
of maybe even just
select count(*) from table where a>b;
--
Peter Eisentraut [EMAIL PROTECTED] http://yi.org/peter-e/
On Fri, 23 Feb 2001, Olaf Zanger wrote:
> i'd like to add up the "true" values of a comparison like
>
> sum(a>b)
>
> it just doesn't work like this
Try
sum(case when a>b then 1 else 0 end)
--
Tod McQuillin
> "Olaf" == Olaf Zanger <[EMAIL PROTECTED]> writes:
Olaf> hi there i'd like to add up the "true" values of a
Olaf> comparison like
Olaf> sum(a>b)
Olaf> it just doesn't work like this
Olaf> any workaround
Try using a case statement:
select sum(case when a > b then 1 e
hi there
i'd like to add up the "true" values of a comparison like
sum(a>b)
it just doesn't work like this
any workaround
postgres 7.0 on linux
thanks
olaf
--
soli-con Engineering Zanger
Dipl.-Ing. (FH) Olaf Marc Zanger
Lorrainestrasse 23
3013 Bern / Switzerland
Fon: +41-31-332 9782
Mob: +
10 matches
Mail list logo