>>I was hoping that since each member of the SET really
>>represents a number, that there would be some bitwise
>>operation that would painlessly produce all the members
>>of the SET that appear at least once.
>
>Sir, I apologize for taking so long to respond. I was moving some
>furniture this weekend and dropped a desk on my keyboard.
No worries Bob. I've only just got back online myself (though my
excuse is more hedonistic - was snowboarding).
>You are right about SETs, and I am blind. The obvious solution is the
>bitwise or. MySQL has a summary function called Bit_Or().
>Unfortunately, it returns a decimal representation of the result, so
>you have to massage it a little.
> SELECT Bin(Bit_Or(column_name)) FROM your_table;
Excellent. I actually tried the Bit_or and Bit_and() functions
but must have screwed up on my binary conversion <aaah!> b/c the
results I had didn't seem to make sense. The Bin() function is
very handy.
>The bits are in reverse order; if your SET declaration includes a, b,
>c, and d, and you columns include all but b, you'll get 1101 from the
>SELECT statement. This is fine if you're going to process the bits in
>your client. But if you want to display the bits in MySQL in the same
>order as your SET declaration, you can use
> Reverse(Binary(Bin(Bit_Or(column_name))))
>which will give you 1011.
Awesome. That's just the ticket.
Thank you very much again,
chas
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php