Jump to content

Query Builder help with JOINs


Jezza
 Share

Recommended Posts

Can anyone tell me if it is possible to nest queries in a SQL JOIN in the Query Builder?

I want to achieve this in SQL:

select o.id_order, r.code 
from ps_orders o 
left outer join ( 
select ocr.id_order, cr.code 
from ps_order_cart_rule as ocr 
inner join ps_cart_rule as cr 
on ocr.id_cart_rule = cr.id_cart_rule 
) r 
on o.id_order = r.id_order

So the LEFT OUTER JOIN needs to be on the result of the nested query (not on a table that exists already which IS supported by the Query Builder).

Is it possible?

Thanks!

I have posted already on the #general Slack channel but no response.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More