MySQL tutorial: EXPORT_SET [EN]
top of page
CerebroSQL

MySQL: 

EXPORT_SET

Syntax:
EXPORT_SET(bits,on,off[,separator[,number_of_bits]])

Returns a string such that for every bit set in the value bits, you get
an on string and for every bit not set in the value, you get an off
string. Bits in bits are examined from right to left (from low-order to
high-order bits). Strings are added to the result from left to right,
separated by the separator string (the default being the comma
character ,). The number of bits examined is given by number_of_bits,
which has a default of 64 if not specified. number_of_bits is silently
clipped to 64 if larger than 64. It is treated as an unsigned integer,
so a value of ?1 is effectively the same as 64.

URL: https://dev.mysql.com/doc/refman/8.0/en/string-functions.html

Example

mysql> SELECT EXPORT_SET(5,'Y','N',',',4);
-> 'Y,N,Y,N'
mysql> SELECT EXPORT_SET(6,'1','0',',',10);
-> '0,1,1,0,0,0,0,0,0,0'

bottom of page