I have the following data in a table like so:
create table tutor(
id int,
accessto varchar(8)
);
The data looks like this:
+-------+----------+
| id | accessto |
+-------+----------+
| 69 | b'1011' |
| 162 | b'1011' |
| 232 | b'1011' |
| 257 | b'0010' |
| 258 | b'1011' |
| 258 | b'1011' |
| 258 | b'1011' |
| 258 | b'1011' |
| 258 | b'1011' |
| 258 | b'1011' |
| 258 | b'1110' |
| 258 | b'1001' |
| 258 | b'0011' |
| 258 | b'1001' |
+-------+----------+
I want to convert this into binary. How is it possible?
I tried these queries but getting the same result:
select id, cast(accessto as BINARY) from tutor;
select id, convert(accessto,binary) from tutor;
How to do this?
My expected result is should be like this:
+-------+----------+
| id | accessto |
+-------+----------+
| 69 | 11 |
| 162 | 11 |
| 232 | 11 |
| 257 | 2 |
| 258 | 11 |
| 258 | 11 |
| 258 | 11 |
| 258 | 11 |
| 258 | 11 |
| 258 | 11 |
| 258 | 14 |
| 258 | 9 |
| 258 | 3 |
| 258 | 9 |
+-------+----------+