here is my laravel DB query
DB::table ( 'zee_hours' )
->select (
[
'zee_hours.hours',
DB::raw ( 'COALESCE(count(zee_shipment_events.amazon_order_id),0)' ),
] )
->leftJoin ( 'zee_shipment_events', 'zee_hours.hours', '=', DB::raw ( 'HOUR(zee_shipment_events.pdate)' ) )
->join ( 'zee_shipment_items', 'zee_shipment_items.shipment_id', '=', 'zee_shipment_events.id' )
->join ( 'zee_promotions', 'zee_promotions.shipment_item_id', '=', 'zee_shipment_items.id' )
->groupBy ( 'zee_hours.hours' )
->get ();
Problem this way, I am only able to get those hours where some order was placed.
what I want is, I need even those hours where no order was placed (showing 0 with them)
Have tried hard, but still, no way
Aucun commentaire:
Enregistrer un commentaire