At 19:02 +0100 11/22/02, Lucas M. Kalita wrote:
>Hi,
>
>Would it be possible to add a function that compares two sets
>(mysql set column type).
>
>Someting like:
>COMPARE_SETS(first_set, second_set)
>
>The function would return FALSE when in second_set there
>are none of the values of first_set. TRUE would be returned
>when second_set has at least one value of those in first_set.
If you use a bitwise AND operator (&) the result will be non-zero
if there is any overlap, 0 if there isn't, and NULL if either operand
is NULL. So use first_set & second_set and check the result.
>
>Example 1:
>
>first_set = 'a,c,d'
>second_set = 'x,y,z'
>COMPARE_SETS would return false
>
>Example 2:
>first_set = 'a,c,d'
>second_set = 'x,y,a'
>COMPARE_SETS would return true
>
>Of course this function can have different behavior, for example:
>- return values that are in first_set and are in second_set
>- return values that are in first_set and are not in second_set (addidtional
>opposite function)
>- return number of values that are in first_set and in second_set
>
>I have read documentation and I couldn't find any function that would
>allow me to compare two sets. I think this function can be useful and
>would be very easy to implement.
>
>LK

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.