We've expanded our news coverage and improved our search! Visit
news.oreilly.com for the latest or search for all things across O'Reilly!
Article:
 |
|
SQL Subqueries
|
| Subject: |
|
Subquery Question |
| Date: |
|
2005-01-27 10:44:48 |
| From: |
|
jcc
|
|
|
|
On the web page, you have:
"we want to first select all of the values for ManagerID and then associate them with a name. We can do that with the following set of queries
SELECT EmployeeName AS Employee
FROM Employees
WHERE EmployeeID IN (SELECT DISTINCT ManagerID FROM Employees)"
Would it be the same if I were to write it like this without using a subquery?
select distinct managerID, employeename
from employees
where managerid <> null;
Thanks.
|