0
I wonder if it is possible to select with Join where the second table will return more than one row and in that create an object with an internal list. For clarity see the example:
Tabela Usuario: idUsuario, nome, cpf
Tabela Veiculos: idVeiculo, nome, placa, dono
select: select u.nome, v.placa from Usuario u JOIN Veiculos v ON v.dono = u.idUsuario;
resultado:
joao, kkk-0000
joao, jjj-0000
paulo, iii-9999
paulo, yyy-9999
In PDO I use the PDO command::FETCH_CLASS and receive the following Object.
Objetoconsulta:
obj[0] = joao, kkk-0000
obj[1] = joao, jjj-0000
obj[2] = paulo, iii-9999
obj[3] = paulo, yyy-9999
I would like to receive this way:
obj[0] = joao, array(kkk-0000,jjj-0000)
obj[1] = paulo, array(iii-9999, yyy-9999)
Maybe this answer helps
– rray