aalekizoglou
User
 Fresh Boarder
| Posts: 4 |   | Karma: 0 |
|
MS SQL Query built wrong
|
|
Posted: 2005/06/08 18:21 |
|
|
|
|
Hi,
I am using AnyDAC with both MySQL 4.1.7 and MS SQL Server 2000.
While building a query for MSSQL database Northwind I saw the builder completes the SQL query in a wrong way. I am trying to joing the following tables:
Products, Categories, Suppliers.
The SQL query is build as follows:
SELECT N.ProductName, N.ProductID, N2.CategoryName, N1.CompanyName FROM [Northwind].[dbo].[Products] N JOIN [Northwind].[dbo].[Categories] N2 ON N.CategoryID=N2.CategoryID, [Northwind].[dbo].[Products] N JOIN [Northwind].[dbo].[Suppliers] N1 ON N.SupplierID=N1.SupplierID
giving an error such as
SQL state: 42000. Native error: 1011. Error message: [Microsoft][ODBC SQL Server Driver][SQL Server]The correlation name 'N' is specified multiple times in a FROM clause.
Though, if I try the SQL text
SELECT N.ProductName, N.ProductID, N2.CategoryName, N1.CompanyName FROM [Northwind].[dbo].[Products] N JOIN [Northwind].[dbo].[Categories] N2 ON N.CategoryID=N2.CategoryID JOIN [Northwind].[dbo].[Suppliers] N1 ON N.SupplierID=N1.SupplierID
it runs correctly. Is it something I am doing wrong or the Query Builder does not take under consideration the RDBMS?
Nasos
|
|