I have two tables in my database, the cad_usuario
and the cad_automovel
. The user registered in the first table can have several vehicles registered in the second table.
SELECT aut.usuario_id, aut.marca, aut.modelo, aut.ano, usr.id, usr.nome_completo, usr.rg FROM cad_automovel as aut INNER JOIN cad_usuario as usr on usr.id = aut.usuario_id
The problem is that when it shows the result in PHP, it shows two lines for the same user
----------
id_usuario: 1
nome_completo: John Doe
rg: 000.000.000
aut.usuario_id: 1
aut.marca: marca1
aut.modelo: modelo1
aut.ano: 2017
---------
id_usuario: 1
nome_completo: John Doe
rg: 000.000.000
aut.usuario_id: 1
aut.marca: marca22
aut.modelo: modelo22
aut.ano: 2007
I need it to look something like this:
---------------
id_usuario: 1
nome_completo: John Doe
rg: 000.000.000
aut.usuario_id: 1
aut.marca: marca1, marca22
aut.modelo: modelo1, marca22
aut.ano: 2017, 2007