Re: [SQL] sum(bool)?

2001-02-26 Thread Oliver Elphick
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

Re: Fwd: Re: [SQL] sum(bool)?

2001-02-25 Thread D'Arcy J.M. Cain
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

[SQL] sum(bool)?

2001-02-24 Thread Olaf Marc Zanger
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

Re: [SQL] sum(bool)?

2001-02-23 Thread Tod McQuillin
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

Re: [SQL] sum(bool)?

2001-02-23 Thread Peter Eisentraut
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/

Re: [SQL] sum(bool)?

2001-02-23 Thread Olaf Zanger
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

Re: [SQL] sum(bool)?

2001-02-23 Thread Andrew Perrin
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