Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 12890

Unpivoting a Query

$
0
0

Hi Experts,

I have a table which contains the following data.

THERA_ID, ENTITY_ID,  CHANNEL_ID,    DRUG_BRD_ID,   TRX1,TRX2....TRX24, NRX1,NRX2...NRX24

For each thera, entity, channel and drug combination, I would have columns 48 columns (24 TRx and 24 NRx). I would like to unpivot this information so that, I shoud get 24 rows.

thera_id     entity_id  channel_id  drug_brd_id, TRXs, NRXs

Here thera, entity, channel and drug_brd is repeating for the 24 rows of TRx and NRx.

Please help.

Thanks in Advance

Naveen


Viewing all articles
Browse latest Browse all 12890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>