Convert a binary to decimal using MySQL

binary, decimal, mysql

Solution

CONV(BINARY(CONCAT(setting1, setting2)), 2, 10)

Problem

I am trying to construct a query in MySQL that concatenates a bunch of binary fields and then gives me the result as DECIMAL. e.g: ``` SELECT CONCAT (setting1, setting2, setting3) AS settings; ``` may gave me: ``` 101 111 110 ``` I want to pass this value to a function (convert? cast?) that will give me the corresponding DECIMAL value: ``` 5 7 6 ``` I've already tried a few combinations of `cast()` and `convert()` but haven't cracked it yet.

Original source