Quantcast
Channel: SQL Server Master Data Services forum
Viewing all articles
Browse latest Browse all 1311

Help for pivot use

$
0
0

Hi

its been a day since I'm searching for the right way to pivot my table.

here are the details:

view name: [dbo].[PIVOTSAMPLE]

Table view

Account Name  ------Charge_To------Expense

ABC----------------------CDS----------------1,000

ABC ---------------------BMG----------------2,000

DEF----------------------CDS----------------1,500

GHI----------------------CDS-----------------4,000

GHI----------------------NSM-----------------3,500

KLM----------------------CDS-----------------2,500

KLM----------------------BMG-----------------1,800

I want my table to look like this

ACCOUNT NAME------CDS---------BMG------------NSM

ABC----------------------1,000--------2,000------------0

DEF----------------------1,500---------0-----------------0

GHI----------------------4,000----------0----------------3,500

KLM----------------------0---------------1,800-----------0

Can anyone help me with the proper pivot query?

Hoping for a favorable response from the group!

best regards,

chard





Viewing all articles
Browse latest Browse all 1311

Trending Articles