SELECT ID, PHONE1, PHONE2, PHONE3, EMAIL1, EMAIL2, EMAIL3, EMAIL4
FROM (SELECT ...)
How do I pivot it into this?
*ID | PHONE | EMAIL*
SELECT DISTINCT ID, PHONE, EMAIL
FROM ...
I can do multiple selects and UNION them but I wonder if there is a better way of doing it. My query is like 400 lines long and doing multiple unions will be a mess!