Tuesday, March 6, 2012

Aggregate bitwise OR

I was doing a SUM on my returned rows and i found that what i really want is an aggregate bitwise OR on all the returned rows. Do you know what's the function for that?

Thank youHmm, the vertical bar ("|") is the bitwise OR operator (see| (Bitwise OR)). Will that help?

Terri|||Yes. but how do i make it an aggregate function.. i.e. to make bitwise or all the return values in a select statement.

for example:

SELECT BitwiseOR(Numbers)
FROM NumbersTable|||i found the solution (thanx to blindman)

here it is:

http://www.dbforums.com/t973116.html|||ran into this problem myself a while ago, so I hacked up a UDF for the purpose - there are probably more efficient ways, but this seems to work well for me.

http://rtfm.atrax.co.uk/infinitemonkeys/articles/sql/992.asp

No comments:

Post a Comment