Subquery
編寫查詢的其他方式
我是 sql 語言的新手,我正在學習子查詢。我有一個問題是有其他方法如何編寫該查詢?
SELECT Employees.FirstName, Employees.LastName FROM Employees WHERE Employees.HireDate < (SELECT MIN(Employees.HireDate) FROM Employees WHERE Employees.City = 'London');
謝謝你,我真的很欣賞你的回答
SELECT Employees.FirstName, Employees.LastName FROM Employees WHERE Employees.HireDate < ALL (SELECT Employees.HireDate FROM Employees WHERE Employees.City = 'London');
我不會發布你的家庭作業的最終答案,但你應該熟悉這個
SELECT TOP(1) ... ORDER BY
結構。例如,下面的查詢可用於獲取最年長員工的出生日期。SELECT TOP(1) BirthDate FROM Employees WHERE BirthDate IS NOT NULL ORDER BY BirthDate