I'm using Codeigniter with MySql 7.5. I have a query and it always returns empty when left join table is empty.
$this->db->select('shop.id as shop_id, shop.shop_name, rg.rating');
$this->db->from('shop');
$this->db->join('booking as bh', 'bh.shop_id = shop.id', 'left');
$this->db->join('rating rg', 'rg.booking_id = bh.id', 'left');
$this->db->group_by("bh.id");
$this->db->order_by("bh.id", "desc");
Here I have entries in booking and shop tables but rating table is empty. But I didn't get any results.
If I remove rg.rating from select it will return correct result.
Did I miss anything? Thanks
group byseems to be wrong'rg.booking_id = bh.id'??bh.id