Good evening,
Well, I have the following problem:
I need to join in two tables, USER and CONTACT. Each user has more than one contact (Phone), so when I 'm ready the data it returns me "duplicate" lines with different phones because, EX:
ID | Nome | Telefone
1 | Felipe | 968181444
1 | Felipe | 37056781
2 | Claudio | 37059999
2 | Claudio | 968899999
Is it possible for me to create a phone column to list the data this way below?
ID | Nome | Telefone 1 | Telefone 2
1 | Felipe | 968181444 | 37056781
2 | Claudio | 37059999 | 968899999
I researched a lot on google, I found something about PIVOT but I could not develop something similar to what I need.
Follow the query:
SELECT u.ID, u.NOME, c.TELEFONE
FROM USUARIO u INNER JOIN CONTATO c
ON c.USUARIO_ID = u.ID
ORDER BY u.NOME
Any solution to this?