I have an Address table as below
CREATE TABLE ADDRESS
(
    PERSON_ID INT,
    ADDRESSLINE1 VARCHAR(100),  
    CITY VARCHAR(100)
)
Data in the table is as below
INSERT INTO ADDRESS 
VALUES (1, 'Street 1', 'CITY1'), (1, 'Street 2', 'CITY1'),
       (1, 'Street 3', 'CITY1'),
       (2, 'Street 1', 'CITY2'), (2, 'Street 2', 'CITY2'),
       (2, 'Street 3', 'CITY3'),
       (3, 'Street 1', 'CITY3'), (3, 'Street 2', 'CITY3')
I need to write a SQL query that returns an output in the below format
PERSON_ID   ADDRESS1                ADDRESS2            ADDRESS3
------------------------------------------------------------------------
1           'Street 1 CITY1'        'Street 2 CITY1'    'Street 3 CITY1'
2           'Street 1 CITY2'        'Street 2 CITY2'    'Street 3 CITY2'
3           'Street 1 CITY3'        'Street 2 CITY3'
The address data (ADDRESSLINE1 and CITY) needs to be concatenated into a single value, and the resultset should have a column for each row in the table. Data needs to grouped based on PERSON_ID
Can this be done using a SQL statement?
 
     
     
    
 
    