How do I join tables in a query?

R

R-Enemy

I'm used to SQL and using the INNER JOIN statement. What is the equivilant
in access?

I'm currently making a .NET application that is making the query and I keep
getting an error when I try to use the JOIN statement.

Thanks.
 
T

Tom Ellison

Dear R:

There is a small difference between Jet SQL and, say, SQL Server. If
you JOIN more than two tables, Jet requires you to parenthesize the
JOINs. Unless you JOIN more than 2 tables, this won't come up.

Otherwise, please post what you have and we'll try to help.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
R

R-Enemy

Thanks...But I'm still having an error come up. Here is my query:

SELECT inv_item.inv_itemID, inv_item.name, inv_item.qty, inv_item.status,
inv_sub.name AS subName, inv_sub.cost, inv_sub.type
FROM inv_item
INNER JOIN inv_item_sub ON inv_item.inv_itemID = inv_item_sub.inv_itemsID
INNER JOIN inv_sub ON inv_sub.inv_subID = inv_item_sub.inv_subID

I'm actually joining 3 tables. I also created these tables on an SQL Server
and the syntax worked perfect. But, for some reasons the database needs to
be in Access.

Thanks again for any help.
 
R

R-Enemy

It was parentheses placement:

SELECT inv_item.inv_itemID, inv_item.name, inv_item.qty, inv_item.status,
inv_sub.name AS subName, inv_sub.cost, inv_sub.type
FROM (inv_item
INNER JOIN inv_item_sub ON inv_item.inv_itemID = inv_item_sub.inv_itemsID)
INNER JOIN inv_sub ON inv_sub.inv_subID = inv_item_sub.inv_subID

This worked great.
Thanks Tom.
 
T

Tom Ellison

Dear R:

Yup, that's what I thought. Glad it helped.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Top