疑问? 怎样在order by里使用子查询时,同时查询出Income-OutCome字段的值。
SELECT Name,Sex,WorkYear,InCome-OutCome
FROM employees,salary
WHERE salary.EmployeeID=employees.EmployeeID
ORDER BY
InCome-OutCome
DESC
-- 等价于
SELECT Name,Sex,WorkYear
FROM employees
ORDER BY
(SELECT InCome-OutCome
FROM salary
WHERE salary.EmployeeID=employees.EmployeeID)DESC