php - Codeigniter SQL query no records in other table -


i join 2 tables there no record in other table.

for example
table name: shop_items

  • shop_item_id
  • shop_item_sk
  • shop_item_name

table name: item_reviews

  • item_review_id
  • item_review_sk
  • item_review_desc
  • item_review_rate
  • shop_item_sk
  • item_review_by

the problem item details doesn't appear when don't have record in item_reviews table

this sql statement

    $query = $this->db->select('*')     ->from('shop_items')     ->join('item_reviews', 'shop_items.shop_item_sk=item_reviews.shop_item_sk','inner')     ->where('shop_items.shop_item_sk',$id)     ->limit(1)     ->get();     return $query->result(); 

i researched union don't know how use in codeigniter. advance thank can me.

use left outer join. here shop_items table left table join item_reviews it.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -