Click here to Skip to main content
15,887,256 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All,

Table

Discipline	Activity	Area
1		1		4
1		1		3
1		1		2
1		2		3
1		2		2
1		2		4

The O/P should be
Discipline	Activity	Area
1		1		2
		1		3
		1		4

		2		2
		2		3
		2		4


PFA the attached table & output format.

What I have tried:

I tried Group by Discipline to display the o/p in the desired format.But we not getting Area orderwise.
Posted
Updated 4-Jul-21 22:03pm
v2

1 solution

You need to use ORDER BY in your select. See SQL ORDER BY Keyword[^]

So something like
SQL
SELECT Discipline,
       Activity,
       Area
FROM YourTable
ORDER BY 
       Discipline,
       Activity,
       Area
 
Share this answer
 
Comments
Maciej Los 5-Jul-21 4:02am    
5ed!
Wendelius 9-Jul-21 13:59pm    
Thanks

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