Skip to main content
Version: V1.0.0

MAKE_SET

Declaration

MAKE_SET(bits,str1,str2,...)

Description

Returns a comma-separated list of strings where the bits in bits are set to 1. str1 corresponds to the 2^0^ bit, str2 corresponds to the 2^1^ bit, and so on. If a corresponding strn does not exist, NULL is returned.

For example, if bits is specified as 5, which is 0101 in binary, str1 and str3 are returned.

Examples

SELECT MAKE_SET(1,'a','b','c');
+-------------------------+
| MAKE_SET(1,'a','b','c') |
+-------------------------+
| a |
+-------------------------+
1 row in set (0.001 sec)

SELECT MAKE_SET(1 | 4,'hello','ocean','base');
+----------------------------------------+
| MAKE_SET(1 | 4,'hello','ocean','base') |
+----------------------------------------+
| hello,base |
+----------------------------------------+
1 row in set (0.001 sec)

SELECT MAKE_SET(1 | 4,'hello','ocean',NULL,'base');
+---------------------------------------------+
| MAKE_SET(1 | 4,'hello','ocean',NULL,'base') |
+---------------------------------------------+
| hello |
+---------------------------------------------+
1 row in set (0.001 sec)