I need a SQL select that can change the orientation of my record. My input file contains one row per unique ID with separate columns for each reference ID and Type. I need to format each row by breaking out each column reference type and ID into a new row.
Input Table:
ID Reference1 ID Reference1 Type Reference 2 ID Reference2 Type
-------- ------------- ------------- ----------------- -----------------
10000 82 GPH 63 LineBuy
10001 55 GPH 43 LineBuy
10002 32 LineBuy
Output Table:
ID Reference ID Reference Type
--------- ------------- ----------------
10000 82 GPH
10000 63 LineBuy
10001 55 GPH
10001 43 LineBuy
10002 32 LineBuy
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.