Reputation: 1244
Normally we use concat_ws to join 2 field into 1 string on same table, how do i put a query to select the field value from other table?
GROUP_CONCAT(CONCAT_WS(' - ', item1_from_this_table, item_2_from_other_table) SEPARATOR '\n')
is it possible?
Upvotes: 0
Views: 186
Reputation: 125835
Join the tables and then (if otherwise ambiguous) table-qualify your column references:
SELECT GROUP_CONCAT(
CONCAT_WS(' - ', t1.item, t2.item)
SEPARATOR '\n'
)
FROM t1 JOIN t2 ON ...
Upvotes: 1