I have database in structure like below

Newspaper State1 state2 state3 state4

ABC 1000 5684 5687 246
DEF 879 2547 2578 2357

But I need to the structure like below

How can i change this

Newspaper State copies

ABC State1 1000
ABC State2 5684
ABC State3 5687
ABC State4 246
DEF State1 879
DEF State2 2547
DEF State3 2578
DEF State4 2357

Pls help me


here is the code

SELECT [NewsPaper]
   (SELECT [NewsPaper]
   FROM [Test].[dbo].[News]) p
   (Copies FOR State IN 
)AS unpvt;

Step 1 Select the data and turn it into a table
Step 2 Select Power Query –> From Table to suck it in to Power Query
Step 3 Un-pivot it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.