Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 Issue With Query

Author  Topic 

SilentCodingOne
Starting Member

20 Posts

Posted - 2008-11-29 : 00:40:01
I'm working on my school work and am having an issue with getting one of the queries to work correctly. The problem is to query the Northwind db for a list of the EmployeeID, LastName and FirstName of all employees who dd not take an order between March 1 and March 7, 1997 using an outer join. I'm able to bring in the orders made between those dates but cannot seem to get a list of employees who did not order. Any help would be appreciated as I have been working on it for hours and am probably just making a simple mistake. Here is what I currently have:


SELECT Employees.EmployeeID, Employees.LastName, Employees.FirstName
FROM Employees LEFT JOIN Orders ON Employees.EmployeeID = Orders.EmployeeID
WHERE (((Orders.OrderDate) Between #3/1/1997# And #3/7/1997#));


Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-29 : 00:47:47
[code]
SELECT Employees.EmployeeID, Employees.LastName, Employees.FirstName
FROM Employees
LEFT JOIN Orders
ON Employees.EmployeeID = Orders.EmployeeID
AND (Orders.OrderDate Between #3/1/1997# And #3/7/1997#)
WHERE Orders.EmployeeID IS NULL
[/code]
Go to Top of Page

SilentCodingOne
Starting Member

20 Posts

Posted - 2008-11-29 : 15:08:09
Thanks for the help
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-30 : 01:01:56
You're welcome
Go to Top of Page
   

- Advertisement -