You can use the a SQL query to achieve the desired result, I just assumed you know there are at most 2 addresses per id. If there are more, you'll need to extend the pattern:
SQLCopy
SELECT
id,
MAX(CASE WHEN rn = 1 THEN address END) AS address_1,
MAX(CASE WHEN rn = 2 THEN address END) AS address_2
FROM (
SELECT
id,
address,
ROW_NUMBER() OVER (PARTITION BY id ORDER BY address) as rn
FROM YourTableName
) AS sub
GROUP BY id;
Then you can use the above SQL query directly in your ADF Lookup activity :
- In your pipeline, add a Lookup activity.
- Configure it to use a dataset linked to your Azure SQL Database.
- Enter the SQL query as provided above.