DB2 query problems

I am trying to run a query against our AS/400 DB2 database and get the following error

Additional information: SQL0104: Token = was not valid. Valid tokens: ON LEFT CROSS INNER RIGHT EXCEPTION.
Cause . . . . . :   A syntax error was detected at token =.  Token = is not a valid token.  A partial list of valid tokens is ON LEFT CROSS INNER RIGHT EXCEPTION.  This list assumes that the statement is correct up to the token.  The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery  . . . :   Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token =. Correct the statement.  The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause.

...for the following query-

SELECT aalgtx.ahoaa, aaaatx.ahoaa, ijhpcd.abrij, aabfcd.ahoaa, dfe3tx.acudf, anjcnb.acuan, ijabnb.abrij
FROM aqhprd.acuan, aqhprd.abrij, aqhprd.ahoaa, aqhprd.acudf
INNER JOIN ana7cd.acuan=ija7cd.abrij and
anabnb.acuan=ijabnb.abrij and
anbvnb.acuan=ijbvnb.abrij and
ijabnb.abrij=aaabnb.ahoaa and
WHERE anjcnb = 12345678

...any idea where I am wrong?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Suspect it should be INNER JOIN something WHERE ana7cd.acuan=ija7cd.abrij and ...

What's the 'something where'?
That, of course, does not address the possible FROM aqhprd.acuan, ... issues.
try rewriting using just the WHERE clause i.e. no INNER JOIN

WHERE  ana7cd.acuan=ija7cd.abrij
AND anabnb.acuan=ijabnb.abrij
AND anbvnb.acuan=ijbvnb.abrij
AND ijabnb.abrij=aaabnb.ahoaa
AND aabfcd.ahoaa=dfapcd.acudf
AND anjcnb = 12345678

What happens

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jimtxasAuthor Commented:
I've made some progress-  still same error but found other issues that I have corrected-

Here's the full query now-

        sql = "SELECT c.aalgtx, c.aaaatx, b.ijhpcd, c.aabfcd, d.dfe3tx, a.anjcnb, b.ijabnb " & _
       "FROM aqhprd.acuan a " & _
       "JOIN aqhprd.abrij b, aqhprd.ahoaa c, aqhprd.acudf d on (a.ana7cd = b.ija7cd) and " & _
                   "(a.anabnb = b.ijabnb) and " & _
                   "(a.anbvnb = b.ijbvnb) and " & _
                   "(b.ijabnb = c.aaabnb) and " & _
                   "(c.aabfcd = d.dfapcd) " & _
                   "WHERE (a.anjcnb = " & RegKey & ""

I also made the following join work successfully, but I need to build it out similar to above, but the following works-

         sql = "SELECT  b.ijhpcd,  a.anjcnb, b.ijabnb " & _
        "FROM aqhprd.acuan a " & _
        "inner JOIN aqhprd.abrij b on a.ana7cd = b.ija7cd " & _
                    "WHERE a.anjcnb = " & RegKey & ""
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.