Since the tables PRODUTO
, CATEGORIA
and a CATEGORY can have several PRODUCTS , I'd like a select
to be listed in a nvarchar column All PRODUCT.NAME of a CATEGORY .
Something like:
select concat( select p.nome from categoria c
inner join produto p on c.id = p.fk_categoria
where c.id = categoria.id) as ProdutosDaCategoria from categoria
Thiscodewillnotworkbutit'sanattempttoexplainwhatIneed.
Youwouldalsohavetoputa"," or other separator character between each result of subquery
.
Does anyone know how to do it?
Note: Any solution that brings all the categories listed and the "name" of the products concatenated in nvarchar addresses the problem (as long as the query does not look unfeasible ).