How to build subqueries in Laravel-5

How can I build the following MySQL query using Laravel-5?

select orders.*, oi.items from orders 
inner join (select order_id, group_concat(item_name SEPARATOR ', ') as items 
from orders_items group by order_id) as oi on oi.order_id = orders.id;

EDIT

The suggested link did not resolve my problem, however I did find a solution and will post it below for others.


Source: laravel

Leave a Reply