I have two tables, one with addresses and the other with people. There is no releation between this tables.
What I need is, based on address (street + number) to show me all people (names) living at that address.
I have;
SELECT people.*, address.*
FROM people
LEFT JOIN people ON people.street = address.street AND people.number = address.number
This give me the results back in rows; every people living at address x returns a row.
address a | person 1
address a | person 2
address a | person 3
address b | person 4
address b | person 5
address c | person 6
But I need it in colums, as in every person that lives on an address value in a different column, like;
address a | person1 | person 2 | person 3
address b | person4 | person5
address c | person6
I think I’ve done it before, but I can’t seem te find out anymore who it worked… Any help please?
Sven Holman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.