-1
I have a question as to the mounting of a select.
I have 3 tables that relate M:N as follows:
Currently I am using this sql:
select p.descricao,
(select descricao from item where item.codigo = c.codigoItem) as items
from produto p inner join composicao c on c.codigoProduto = p.codigo
inner join item i on i.codigo = c.codigoItem
order by p.codigo
and the result comes like this:
Beauty, however it would be possible to make an output as in the image below direct by sql?
Has some function to define a group by or you’d have to ride a stored Procedure? At first I’m solving the issue of direct display in Java, testing if at each iteration the product is the same.
Try this https://stackoverflow.com/questions/276927/can-i-concatenate-multiple-mysql-rows-into-one-field
– Wictor Chaves
Great @Wictorchaves, following the tips that are in this link that you passed worked. Now have to mark as solved? Put the answer?
– Donadon