Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i want to make a matrix query which would return .....

Status
Not open for further replies.

adnan737

Technical User
Jan 17, 2002
2
US
i'm a biginner in sql and want to make a matrix query using just group functions and comparison operators, which would return three max and min. sal in emp table.
 
You can use a UNION query and the TOP predicate to get the result you want.

--Get three maximum salaries
SELECT TOP 3 EmpID, EmpName, Sal
FROM Emp
ORDER By Sal Desc

UNION ALL

--Get three minimum salaries
SELECT TOP 3 EmpID, EmpName, Sal
FROM Emp
ORDER By Sal Terry L. Broadbent
Programming and Computing Resources
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top