Skip to content
Advertisement

SELECT to return duplicate distinct column values

Tying to have query that can duplicate some column values based off values in other columns. ID1 column will always have a value and ID2 and ID3 may or may not. Data in table looks like this.

Wanting to to query this table to show resultset like this

Been stabbing at this trying case selects, and inserting into temp tables. Im stuck.

Advertisement

Answer

You can use cross apply to unpivot the data:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement