473,387 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem with inner join

Hi!

I try to do a nested inner join by sql, but I always get an
"Syntax-error in FROM-clause".

The statement I try around with is:

SELECT * FROM st1
INNER JOIN st2
INNER JOIN st3
ON st1.id_col=st2.id_col
ON st2.id_col=st3.id_col
;

In my real statement, there are some WHERE-clauses, I don't select *
and st1, st2 and st3 and aliases for the same table.

Can anybody give me a hint about what's wrong with this statement? I
already tried lots of different variants with brackets (found in the
JET-reference and in the web and AND's between the ON's but nothing
worked...

CU
Goodbyte

Nov 13 '05 #1
4 2466
I think the syntax is FROM table 1 JOIN table 2 ON joined fields JOIN
table 3 ON joined fields. Try:

SELECT ...
FROM st1
INNER JOIN st2
ON st1.id_col = st2.id_col
INNER JOIN st3
ON st1.id_col = st3.id_col

Hope this helps!

Howard Brody
al*****@gmx.de wrote:
Hi!

I try to do a nested inner join by sql, but I always get an
"Syntax-error in FROM-clause".

The statement I try around with is:

SELECT * FROM st1
INNER JOIN st2
INNER JOIN st3
ON st1.id_col=st2.id_col
ON st2.id_col=st3.id_col
;

In my real statement, there are some WHERE-clauses, I don't select *
and st1, st2 and st3 and aliases for the same table.

Can anybody give me a hint about what's wrong with this statement? I
already tried lots of different variants with brackets (found in the
JET-reference and in the web and AND's between the ON's but nothing
worked...

CU
Goodbyte


Nov 13 '05 #2
SELECT * FROM st1
INNER JOIN st2
ON st1.id_col = st2.id_col
INNER JOIN st3
ON st1.id_col = st3.id_col
;

leads to "Syntax error (missing operator) in query expression
"st1.id_col=st2.id_col INNER JOIN st3 ON st1.id_col=st3.id_col".
:-(

CU
Stefan

Nov 13 '05 #3
Isn't anybody out there, who can help me with this little query?

CU
Stefan

Nov 13 '05 #4
ok, I found it:
with st1 to st3:

SELECT * FROM (st1
INNER JOIN st2
ON st1.id_col = st2.id_col)
INNER JOIN st3
ON st1.id_col = st3.id_col
;

with st1 to st4:

SELECT * FROM ((st1
INNER JOIN st2
ON st1.id_col = st2.id_col)
INNER JOIN st3
ON st1.id_col = st3.id_col)
INNER JOIN st4
ON st1.id_col = st4.id_col
;

CU,
Stefan

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Dave | last post by:
Hi all, I've been trying to figure this out for the last day and a half and it has me stumped. I've got a web application that I wrote that keeps track of trading cards I own, and I'm moving it...
2
by: Bruce Duncan | last post by:
I'm a bit new to MySQL (know MS SQL well...and that may be the problem...getting the syntax confused) and I'm having a join problem...can anyone offer some help? Here's my problem: I have table1...
1
by: Keith | last post by:
I have created a view to test some of the data in my database. I am relatively new to SQL so may have caused this problem by doing something wrong. I have a table called SYS_Individual which...
10
by: david | last post by:
Hi, I have the following code which returns an error when run as part of my ASP SQL.... strquery = strquery & "FROM (Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID)...
8
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
1
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
21
by: mollyf | last post by:
I'm creating a query, which I want to use in code in my VB.NET app. This query produces the correct results when executed in Access: SELECT tblEncounters.EncounterBeginDT, Query11.RID,...
1
by: imranpariyani | last post by:
Hi i have a severe performance problem with one of my views which has 6 to 8 joins .. any help will be appreciated.. the view is: CREATE OR REPLACE VIEW thsn.trade_view AS SELECT...
10
by: MLH | last post by:
Gentlemen: I am having one heck of a time taking a DAO walk through the records in an SQL dynaset. I'm trying to walk a set of records returned by a UNION query. I'm attempting to filter the...
3
by: Anila | last post by:
Hi Friends, My problem with Inner join is ... first i joined two tables and i got the result. after that iam trying to join one more table its giving syn tax error in JOIN condition. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.