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
 Transact-SQL (2005)
 Syntax Error

Author  Topic 

Tyecom
Starting Member

12 Posts

Posted - 2011-04-07 : 00:20:45
I new at SQL and is try to query multiple tables in the Northwind database. I created a backup to the "employees" table and created a query to find rows that have different values. That part seems to work ok, but I also want to query a third table "customers" also, but keep getting syntax errors. Please see syntax below:

Select EmployeeID, LastName, FirstName, City, Region, Extension

FROM dbo.Employees, dbo.Customers

WHERE NOT EXISTS

(SELECT 1 FROM dbo.Employeesbk

WHERE dbo.Employees.EmployeeID = dbo.Employeesbk.EmployeeID

AND dbo.Employees.LastName = dbo.Employeesbk.LastName

AND dbo.Employees.FirstName = dbo.Employeesbk.FirstName

AND dbo.Employees.City = dbo.Employeesbk.City

AND dbo.Employees.Region = dbo.Employeesbk.Region

AND dbo.Employees.Extension = dbo.Employeesbk.Extension

)

AND Select * from customers where customerid = 'frank'


Thank you in advance for you help!

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-04-07 : 01:12:22
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=159153


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -