Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I need solution for this, I have a database of over 1 millions rows
That's why I need
Year	Month	             AccountName	AccountType	Amount
2016	August	        School Fees Income	Credit	        50000
2016	December	Scholarship Expense	Debit	        50000
2016	December	School Fees Income	Credit	        275000
2016	November	Scholarship Expense	Debit	        1005000
2016	November	School Fees Income	Credit	        1990000
2016	October	        Scholarship Expense	Debit	        790000
2016	October	        School Fees Income	Credit	        3385600
2016	September	Scholarship Expense	Debit	        155000
2016	September	School Fees Income	Credit	        2340001
2017	August	        Building Construction	Debit	        210000
2017	August	        Electricity Bill        Debit	        17750
2017	December	Charity  Donations	Debit	        25000
2017	December	Farm Expense - DownFarm	Debit	        485000
2017	December	Farm Expense - UpFarm	Debit	        526650
2017	December	Guard Dogs Maintenance	Debit	        24000
2017	December	Payroll	                Debit	        105000
2017	December	Petty Cash Account	Debit	        400
2017	December	Telecommunication	Debit	        28996
2017	December	Water Bill Expense	Debit	        2677
2017	January	       Scholarship Expense      Debit           3055000
2017	January	       School Fees Income       Credit	        525000


What I have tried:

I want solution for pivot in TSQL only, My database rows are over 1 million rows
Need it to convert it in columns as Pivot
Posted
Updated 2-Jan-18 1:58am
v3
Comments
OriginalGriff 29-Dec-17 15:36pm    
And?
What have you tried?
Where are you stuck?
What help do you need?

1 solution

Well, you did not provided sql engine. Nevertheless...

Follow this link: LMGTFY (PIVOT T-SQL)[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900