Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- DepartmentID,
- AVG(Salary) AS AverageSalary INTO New_Table1
- FROM Employees
- GROUP BY DepartmentID
- SELECT TOP(15) -- Тук е 15 за да се видят всички записи с ID=4 и че John Wood го има, но ако вземем само TOP(10) го отрязва
- FirstName,
- LastName,
- Employees.DepartmentID
- FROM New_Table1
- JOIN Employees ON New_Table1.DepartmentID = Employees.DepartmentID
- WHERE Salary > AverageSalary
- ORDER BY Employees.DepartmentID
Advertisement
Add Comment
Please, Sign In to add comment