I would like to know if it is possible to do a select with join where the second table table will return more than one row and in that create an object with an inner list. To get clearer, 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 :: FETCH_CLASS command and I get the following Object.
Query object:
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:
obj[0] = joao, array(kkk-0000,jjj-0000)
obj[1] = paulo, array(iii-9999, yyy-9999)