How to display min and max salary from a table at a time (2 records at a time, one with max and another with min)?
My input table data:
empid ename sal
1 A 2000
2 B 1000
3 C 1500
4 D 5000
5 E 7000
Output:
sal
7000 -- max
2000 -- min
You can just use a Union
:
Select MAX(Sal)
From TableA
UNION ALL
Select Min(Sal)
From TableA
This would give you your desired output:
sal
7000 -- max
2000 -- min
More information on Unions can be found here.