Let’s say I want to produce a column called provinces that looks like ‘QU/ON/AB’
select *, (select pr from table provinces where something = something) as provinces from t;
How do I combine the results of the inner select as above?
Let’s say I want to produce a column called provinces that looks like ‘QU/ON/AB’
select *, (select pr from table provinces where something = something) as provinces from t;
How do I combine the results of the inner select as above?
on what database ?
that matters
Have a look at group_concat.
http://www.w3resource.com/mysql/aggregate-functions-and-grouping/aggregate-functions-and-grouping-group_concat.php
You’ll want something like
SELECT *, SELECT concat_provinces FROM (SELECT GROUP_CONCAT( pr ) AS concat_provinces FROM provinces WHERE something=something) AS provinces FROM t
(I’m not quite sure of the syntax - you may not need that concat_provinces in there)
Thanks @Hamish Symington
Oracle @Norman Palardy