SQL Error same exposed names

Murray Brown
Murray Brown used Ask the Experts™
on
Hi
I get the following error when trying to run the SQL further down

Msg 1013, Level 16, State 1, Line 1
The objects "Orders" and "Orders" in the FROM clause have the same exposed names. Use correlation names to distinguish them.


SELECT [Orders].[Order ID], [Orders].[Employee ID], [Orders].[Order Date], [Orders].[Order Date], [Orders].[Shipped Date], [Orders].[Shipper ID], [Orders].[Ship Name], [Orders].[Ship Address], [Orders].[Ship Address], [Orders].[Ship City], [Orders].[Ship State/Province], [Orders].[Ship ZIP/Postal Code], [Orders].[Ship Country/Region], [Orders].[Ship Country/Region], [Orders].[Shipping Fee], [Orders].[Taxes], [Orders].[Payment Type], [Orders].[Paid Date], [Orders].[Notes], [Orders].[Tax Rate], [Orders].[Tax Status], [Orders].[Status ID], [Invoices].[Invoice ID], [Invoices].[Invoice Date], [Invoices].[Invoice Date], [Invoices].[Due Date], [Invoices].[Tax], [Invoices].[Shipping], [Invoices].[Amount Due], [Customers].[ID], [Customers].[Company], [Customers].[Last Name], [Customers].[First Name], [Customers].[E-mail Address], [Customers].[Job Title], [Customers].[Business Phone], [Customers].[Home Phone], [Customers].[Fax Number], [Customers].[Address], [Customers].[City], [Customers].[State/Province], [Customers].[ZIP/Postal Code], [Customers].[ZIP/Postal Code], [Customers].[Country/Region], [Customers].[Web Page], [Customers].[Notes], [Customers].[Attachments] FROM [Orders] LEFT JOIN [Customers] ON ([Orders].[Customer ID] = [Customers].[ID]), [Orders] RIGHT JOIN [Invoices] ON ([Orders].[Order ID] = [Invoices].[Order ID])
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
in the 'left join' part of your initial post, you have the orders table listed again, comma separated. try below

SELECT [Orders].[Order ID], [Orders].[Employee ID], [Orders].[Order Date], [Orders].[Order Date], [Orders].[Shipped Date], [Orders].[Shipper ID], [Orders].[Ship Name], [Orders].[Ship Address], [Orders].[Ship Address], [Orders].[Ship City], [Orders].[Ship State/Province], [Orders].[Ship ZIP/Postal Code], [Orders].[Ship Country/Region], [Orders].[Ship Country/Region], [Orders].[Shipping Fee], [Orders].[Taxes], [Orders].[Payment Type], [Orders].[Paid Date], [Orders].[Notes], [Orders].[Tax Rate], [Orders].[Tax Status], [Orders].[Status ID], [Invoices].[Invoice ID], [Invoices].[Invoice Date], [Invoices].[Invoice Date], [Invoices].[Due Date], [Invoices].[Tax], [Invoices].[Shipping], [Invoices].[Amount Due], [Customers].[ID], [Customers].[Company], [Customers].[Last Name], [Customers].[First Name], [Customers].[E-mail Address], [Customers].[Job Title], [Customers].[Business Phone], [Customers].[Home Phone], [Customers].[Fax Number], [Customers].[Address], [Customers].[City], [Customers].[State/Province], [Customers].[ZIP/Postal Code], [Customers].[ZIP/Postal Code], [Customers].[Country/Region], [Customers].[Web Page], [Customers].[Notes], [Customers].[Attachments] 
FROM [Orders] 
LEFT JOIN [Customers] 
           ON ([Orders].[Customer ID] = [Customers].[ID])
RIGHT JOIN [Invoices] 
           ON ([Orders].[Order ID] = [Invoices].[Order ID]) 

Open in new window

Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks very much

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial