Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi!

I have a sql result like this:
|parktype|areaid|total|
|--------|------|-----|
|    2   |   A  | 100 |
|    3   |   A  | 200 |
|    2   |   B  | 300 |
|    3   |   B  | 400 |


And I want it to display something like this in c#:
A
2: P 100
3: P 200

B
2: P 300
3: P 400

Thank you for the help.
Posted

See, for instance, this Stack Overflow question on PIVOT tables: MySQL pivot table[^].
 
Share this answer
 
If you want to customize it in SQL server then use PIVOT Table, if you want to customize the same in C#, wrote your own code logic, if you struck in any place revert back to us.
 
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