Click to See Complete Forum and Search --> : SQL Query


shrini
October 2nd, 2001, 11:20 PM
Find DeptNo in which Maximum number of Employees are working from Employee table having EmpNo and DeptNo as fields.

Cakkie
October 3rd, 2001, 02:29 AM
This will give you one record with one field, containing the DeptNo that has the most employees in it

SELECT TOP 1 DeptNo
FROM Employees
GROUP BY DeptNo
ORDER BY Count(DeptNo) DESC





Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook