Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent
Last updated 1 year ago.
0

If anybody is interested in future I solved it like this...

$sales = DB::table('order_lines')
        ->join('orders', 'orders.id', '=', 'order_lines.order_id')
        ->select(DB::raw('sum(order_lines.quantity*order_lines.per_qty) AS total_sales'))
        ->where('order_lines.product_id', $product->id)
        ->where('orders.order_status_id', 4)
        ->first();
Last updated 1 year ago.
0

This worked like a charm. Thank you.

Last updated 1 year ago.
0

Thanks, it works great

0

Sign in to participate in this thread!

Eventy

Your banner here too?

netm netm Joined 2 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.