let’s suppose table t as the follwing:
t table:
a b c d e
a1 b1 c1 d1 e1
a2 b2 c2 d2 e2
a3 b3 c3 d3 e3
. . . . .
. . . . .
. . . . .
this query throws an #1242 error:
SELECT CONCAT_WS( '*', (SELECT CONCAT_WS( '_', a, b, c) FROM t)) AS test
Expected result is:
test
a1_b1_c1*a2_b2_c2*a3_b3_c3*.....
What’s the best woraround?
The problem is that “t” has more than one row. Perhaps you want one of the following:
or
Oops, I missed the expected results in the question. You want:
(This assumes that there is a column called “id” for ordering the results. If not, leave out the order by clause.)