I like to use the result from another query to address the column name. For this I like to use CONCAT()
. But somehow it don't work; when I run this line I get 0 rows back:
SELECT * FROM cover WHERE CONCAT('c','9') = 1;
When I don't make use of CONCAT()
it work perfectly:
SELECT * FROM cover WHERE c9 = 1;
And also CONCAT()
seems to work. With this I get a result:
SELECT CONCAT('c','9');
I tried all solution from this question: MySQL select with CONCAT condition
like this one, but i always got 0rows back:
SELECT * FROM (
SELECT id, CONCAT('c', '9') as target
FROM cover) base
WHERE target = "1"
My MySQL Version is; 10.1.16-MariaDB