I have 2 tables rtz_order and rtz_restaurant
From order I want purchaseprice from restaurant i want "restaurant_commission" both have a column called restaurant_id So i want to join these to tables and add the restaurant_commission tot the query. I have come up with this (the date part etc works, i was already using that but the query does not work since I added the join)
$sql = 'SELECT order.orderpurchase, order.orderdate, order.status, order.restaurant_id, res.restaurant_commission, res.restaurant_id FROM rt_order order LEFT JOIN rt_restaurant res ON order.restaurant_id = res.restaurant_id WHERE date(order.orderdate) >= date(?) AND date(order.orderdate) <= date(?) AND order.restaurant_id = ? AND order.status = "completed"'; I have tried diffrent things but i do not see why this is going wrong