0

Hi,

I want to convert Single Column values to Row.

Table Original Content:

Code Amount Expenditure
10027 5000.00 LOCAL CONVEYANCE
10027 320.00 LOCAL CONVEYANCE
10116 1589.00 TRAVEL EXPENSES
10095 350.00 LOCAL CONVEYANCE
10095 1215.00 TRAVEL EXPENSES

Expected Output :

Code LC TE
10027 5000.00 NULL
10027 320.00 NULL
10116 NULL 1589.00
10095 350.00 1215.00


Thanks in Advance

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by BitBlt
0

If you had some way of grouping the rows (such as a date?) you could use a PIVOT construct. However, based on your example data, I don't see any relationship of how you could reasonably show both LC and TE. Here's what I mean...look at this scenario:

Code  Amount   Expenditure
10027 5000.00  LOCAL CONVEYANCE
10027  320.00  LOCAL CONVEYANCE
10027  100.00  TRAVEL EXPENSES  <----new example row added to your scenario
10116 1589.00  TRAVEL EXPENSES
10095  350.00  LOCAL CONVEYANCE
10095 1215.00  TRAVEL EXPENSES

Where would line 4 go? With line 2 or with line 3? The only thing I can think of is to do it programmatically rather than with straight SQL. More explanation is in order.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.