我的任務是顯示該經理的最低薪酬員工的MGR和薪水。最小()Access中的子查詢
我需要排除MGR未知的任何人,並且排除最低工資低於1000美元的任何羣體。結果應按工資降序排列。
下面是表:
+-------+--------+-----------+------+------------+-----------+-----------+------+
| Empno | Ename | Job | Mgr | Hiredate | Sal | Comm | Dept |
+-------+--------+-----------+------+------------+-----------+-----------+------+
| 7839 | KING | PRESIDENT | | 11/17/1981 | $5,000.00 | $0.00 | 10 |
| 7782 | CLARK | MANAGER | 7839 | 6/9/1981 | $2,450.00 | $0.00 | 10 |
| 7934 | MILLER | CLERK | 7782 | 1/23/1982 | $1,300.00 | $0.00 | 10 |
| 7902 | FORD | ANALYST | 7566 | 12/3/1981 | $3,000.00 | $0.00 | 20 |
| 7788 | SCOTT | ANALYST | 7566 | 12/9/1982 | $3,000.00 | $0.00 | 20 |
| 7876 | ADAMS | CLERK | 7788 | 1/12/1983 | $1,100.00 | $0.00 | 20 |
| 7369 | SMITH | CLERK | 7902 | 12/17/1980 | $800.00 | $0.00 | 20 |
| 7566 | JONES | MANAGER | 7839 | 4/2/1981 | $0.00 | $0.00 | 20 |
| 7698 | BLAKE | MANAGER | 7839 | 5/1/1981 | $2,850.00 | $0.00 | 30 |
| 7499 | ALLEN | SALESMAN | 7698 | 2/20/1981 | $1,600.00 | $300.00 | 30 |
| 7844 | TURNER | SALESMAN | 7698 | 9/8/1981 | $1,500.00 | $0.00 | 30 |
| 7521 | WARD | SALESMAN | 7698 | 2/22/1981 | $1,250.00 | $500.00 | 30 |
| 7654 | MARTIN | SALESMAN | 7698 | 9/28/1981 | $1,250.00 | $1,400.00 | 30 |
| 7900 | JAMES | CLERK | 7698 | 12/3/1981 | $950.00 | $0.00 | 30 |
+-------+--------+-----------+------+------------+-----------+-----------+------+
這裏是我到目前爲止的代碼:
SELECT EMp.Mgr, EMp.Ename, EMp.Sal AS Sal
FROM EMp
GROUP BY EMp.Mgr, EMp.Ename, EMp.Sal
HAVING (((EMp.Mgr) Is Not Null) AND ((EMp.Sal)>1000))
ORDER BY EMp.Sal DESC;
我目前的代碼的問題是,它沒有考慮到最低工資的參數。我相信這需要通過使用子查詢完成,但我完全相信如何繼續...
任何人都可以請協助嗎?
什麼是sal列的數據類型? –
這是一個貨幣數據類型 – Darren
你可以試試emp.sal> CCur(1000)? –