Declaration
MAKE_SET(bits,str1,str2,...)
Description
Returns a set of strings where the bits specified by bits are set to 1, separated by commas (,). str1 corresponds to the 2^0^ bit, str2 corresponds to the 2^1^ bit, and so on. If the strn for a corresponding bit does not exist, NULL is returned.
For example, if bits is specified as 5, which converts to binary as 0101, then str1 and str3 are returned.
Examples
obclient> SELECT MAKE_SET(1,'a','b','c');
+-------------------------+
| MAKE_SET(1,'a','b','c') |
+-------------------------+
| a |
+-------------------------+
1 row in set
obclient> SELECT MAKE_SET(1 | 4,'hello','ocean','base');
+----------------------------------------+
| MAKE_SET(1 | 4,'hello','ocean','base') |
+----------------------------------------+
| hello,base |
+----------------------------------------+
1 row in set
obclient> SELECT MAKE_SET(1 | 4,'hello','ocean',NULL,'base');
+---------------------------------------------+
| MAKE_SET(1 | 4,'hello','ocean',NULL,'base') |
+---------------------------------------------+
| hello |
+---------------------------------------------+
1 row in set