> No I think he needs the value of 7 to be returned by the select if
> there are 3 records, with value 1, 2 and 4. I toyed with the idea of
> suggesting a query which uses an aggregate (SUM()) but I thought that
> that isn't the answer, as the values might not be just flags but could
> have more bits set, which then would result in bad values. 
>
> So I think it can't be done in 1 query, but perhaps some sql wiz knows
> how to solve it 
>
Your are right on what I am looking for. I want an equivalent SUM operation
but doing a bitwise OR instead.
I was directed to this query that seems to do what I am looking for. Seems
like a lot of work. I wish there was just a simple keyword like SUM to do
it, but the results are what I want. Not sure how good this is when it
comes to performance.
SELECT SUM(Distinct Value & 1) + SUM(Distinct Value & 2) + SUM(Distinct
Value & 4) + SUM(Distinct Value & 8) -- Take this out to bits neeeed
FROM tbl
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------