How to count ones in a bit string? - Mailing list pgsql-novice

From Cheng
Subject How to count ones in a bit string?
Date
Msg-id 4F43B923.1010402@gmail.com
Whole thread Raw
Responses Re: How to count ones in a bit string?  (Richard Broersma <richard.broersma@gmail.com>)
List pgsql-novice
For example, I have a bit string as:

B'101000000000000000000010'

How do I count the number of ones in it? In this example, it is 3.

Thanks,
Cheng

pgsql-novice by date:

Previous
From: Ganesh Borse
Date:
Subject: Request for help on selecting bytea columns using ODBC (windows) from Postgresql DB
Next
From: Richard Broersma
Date:
Subject: Re: How to count ones in a bit string?