Re: INNER JOIN Using ADOQuery
- From: "Ray Marron" <me@xxxxxxxxxxx>
- Date: Thu, 30 Mar 2006 08:12:01 -0700
"eddela" <llcrcaero@xxxxxxxxx> wrote in message
news:442bec8b$1@xxxxxxxxxxxxxxxxxxxxxxxxx
In a small App, I am using an ADOQuery component to inner join two
MSAccess tables and do a query involving fields from both tables. The SQL
property of the ADOQuery has this statement.
SELECT Item, Description, Vendor FROM Table1, Table2
WHERE Table1.Item = Table2.Item
This statement is right out of the text book, yet the following error
message appears. "The specified field 'Item' could refer to more than one
table listed in the FROM clause of your SQL statement."
Of course it does, but why is the exception raised? Please help. Thanks
You and I know that it doesn't matter which table the Item field comes from,
but the parser doesn't and is incapable of making such a decision. Always
be specific about which table a field comes from, even when there's
currently no question. Table layouts have a habit of changing, even in
seemingly trivial applications.
SELECT t1.Item, t2.Description, t2.Vendor FROM Table1 t1, Table2 t2 WHERE
t1.Item = t2.Item;
"Eschew Ambiguity". :)
--
Ray Marron
.
- Prev by Date: Re: Inserts so slow using _Connection.Execute
- Next by Date: Re: Automating DTS conversion?
- Previous by thread: Removing Duplicates
- Next by thread: Re: INNER JOIN Using ADOQuery
- Index(es):
Relevant Pages
|