JOIN expression not supported

63falcondude

Well-known Member
Joined
Jan 15, 2016
Messages
3,572
Can someone help me sort out this SQL in Access? I was getting a Syntax Error before adding the parenthesis to the FROM part of the code and am now getting the error "JOIN expression not supported". I am assuming the error is coming from the FROM part of the code but will include the entire code below.

Code:
select 
d3.descrlong as OrderType,
o.no_int as OrderNo, 
op.prodid2 as Model,
op.serialno as Serial,
o.empliddispo,
to_char(o.logtime,'mm/dd/yyyy') as OrderCreationDate, 
to_char(o.closetime,'mm/dd/yyyy') as OrderCloseDate, 
to_char(o.invdat, 'mm/dd/yyyy') as InvoiceDate,
a.no_int as itemno,
a.nam as Name,
ao.price as Price,
ao.LISTPRICE as listprice,
d1.descrlong as Invoicetype,
d2.descrlong as subtype




FROM (((((((ordhead o 
INNER JOIN ordpos op ON o.orders_ik = op.orders_ik)
INNER JOIN orderrole r ON o.orders_ik = r.orders_ik)
LEFT JOIN articleorder ao ON ao.orders_ik = o.orders_ik)
INNER JOIN article a ON ao.article_ik = a.article_ik)
INNER JOIN descriptions d1 ON d1.record_ik = ao.clearingclass)
INNER JOIN descriptions d2 ON d2.record_ik = ao.clearingtyp)
INNER JOIN descriptions d3 ON d3.record_ik = o.typ)




WHERE
o.typ not in (5707)
and o.stat = 5506
and o.closetime between to_date('01-01-2016','mm-dd-yyyy') and to_date('08-31-2016','mm-dd-yyyy')+1
and r.partnerrole = 50301
and ao.typ = 52702
and ao.delflg = 0
and d1.lang = 5102
and d2.lang = 5102
and d3.lang = 5102


;
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
don't know if this is your problem, but I know access sometimes trouble with left join and inner joins in the same query
 
Upvote 0
You might want to try nesting it in a subquery, and see if that gets around that issue.
 
Upvote 0
One way you can do it as a beginner is to do "query of queries".
That is, you can have queries based off of other queries.
So, trying doing the query without the LEFT JOIN, they save it. Then use that query you just created in a new query, with your LEFT JOIN. Or vice versa (start of with the LEFT JOIN in the first query, and then create a new query from that query).
 
Upvote 0
One way you can do it as a beginner is to do "query of queries".
That is, you can have queries based off of other queries.
So, trying doing the query without the LEFT JOIN, they save it. Then use that query you just created in a new query, with your LEFT JOIN. Or vice versa (start of with the LEFT JOIN in the first query, and then create a new query from that query).

This was one of the things that I tried after finding out that the combination of the two JOIN types could be the problem. I got a "Syntax error in JOIN operation" after removing the LEFT JOIN (along with corresponding parenthesis).
 
Upvote 0
You may find you have more luck if you use the Query Builder to build it, and let Access figure out the parentheses instead of trying to write the SQL yourself, especially if you fairly new to it.
 
Upvote 0
You may find you have more luck if you use the Query Builder to build it, and let Access figure out the parentheses instead of trying to write the SQL yourself, especially if you fairly new to it.

I think that is a good idea. I'll have to try that.
 
Upvote 0
Figured it out today. I had to delete the spaces in between the code. The working code was

Code:
select 
d3.descrlong as OrderType,
o.no_int as OrderNo, 
op.prodid2 as Model,
op.serialno as Serial,
o.empliddispo,
to_char(o.logtime,'mm/dd/yyyy') as OrderCreationDate, 
to_char(o.closetime,'mm/dd/yyyy') as OrderCloseDate, 
to_char(o.invdat, 'mm/dd/yyyy') as InvoiceDate,
a.no_int as itemno,
a.nam as Name,
ao.price as Price,
ao.LISTPRICE as listprice,
d1.descrlong as Invoicetype,
d2.descrlong as subtype
FROM ordhead o 
INNER JOIN ordpos op ON o.orders_ik = op.orders_ik
INNER JOIN orderrole r ON o.orders_ik = r.orders_ik
LEFT JOIN articleorder ao ON ao.orders_ik = o.orders_ik
INNER JOIN article a ON ao.article_ik = a.article_ik
INNER JOIN descriptions d1 ON d1.record_ik = ao.clearingclass
INNER JOIN descriptions d2 ON d2.record_ik = ao.clearingtyp
INNER JOIN descriptions d3 on d3.record_ik = o.typ
WHERE
o.typ not in (5707)
and o.stat = 5506
and o.closetime between to_date('01-01-2016','mm-dd-yyyy') and to_date('08-31-2016','mm-dd-yyyy')+1
and r.partnerrole = 50301
and ao.typ = 52702
and ao.delflg = 0
and d1.lang = 5102
and d2.lang = 5102
and d3.lang = 5102
;
 
Upvote 0

Forum statistics

Threads
1,221,798
Messages
6,162,027
Members
451,737
Latest member
MRASHLEY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top