I have a query which I'm trying to group multiple table columns as "text", have a look at my query:
SELECT a.id as id,
a.name AS title,
(a.address1, a.address2, a.suburb, a.state, a.pcode) AS text,
a.suburb AS suburb
I get this error when trying to use it this way:
1241 - Operand should contain 1 column(s)
Is what I'm trying to do impossible? Is there a work around for this?
You'd want to use the CONCAT function:
SELECT a.id, a.name, CONCAT(a.address1, a.address2, etc...)
FROM ...
on other databases you'd accomplish it by using the &
or +
operators instead, but MySQL uses concat()
.