Olaf Marc Zanger wrote:
hi there,
i want to add up the "true" values of a comparison like
sum(ab)
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(ab)
it just doesn't work like this
any workaround?
I did exactly the same thing two months ago
I created this tiny function:
CREATE
hi there,
i want to add up the "true" values of a comparison like
sum(ab)
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
On Fri, 23 Feb 2001, Olaf Zanger wrote:
i'd like to add up the "true" values of a comparison like
sum(ab)
it just doesn't work like this
Try
sum(case when ab then 1 else 0 end)
--
Tod McQuillin
Olaf Zanger writes:
i'd like to add up the "true" values of a comparison like
sum(ab)
sum(case when ab then 1 else 0 end)
of maybe even just
select count(*) from table where ab;
--
Peter Eisentraut [EMAIL PROTECTED] http://yi.org/peter-e/
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
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