-4

I want to Joint Plan and tag_category_banching Table.I want to Get Result Like That from both plan and tag_category_banching . enter image description here enter image description here

Array
 (
 [0] => Array
   (
    [plan_id] => 3
    [plan_user_id] => 1
    [plan_title] => 3 Months
    [plan_validity] => 90
    [plan_desc] => 90 days
    [plan_activation] => 1
    [plan_status] => 1
    [banch_id] => 4
    [products_id] => 3
    [tag_cat_id] => 3
    [tag_cat_name] => 3 Months
    [nw_eb_mz_art_type] => 3
    [tag_cat_type] => 2
    [plan_price] => 200
)
[1] => Array
(
    [plan_id] => 4
    [plan_user_id] => 1
    [plan_title] => 1 Month
    [plan_validity] => 30
    [plan_desc] => 30 days.
    [plan_activation] => 1
    [plan_status] => 1
    [banch_id] => 3
    [products_id] => 3
    [tag_cat_id] => 4
    [tag_cat_name] => 1 Month
    [nw_eb_mz_art_type] => 3
    [tag_cat_type] => 2
    [plan_price] => 100
)
[2] => Array
(
    [plan_id] => 1
    [plan_user_id] => 1
    [plan_title] => 1 yr plan
    [plan_validity] => 365 days
    [plan_desc] => 365 days.
    [plan_activation] => 1
    [plan_status] => 1
    [banch_id] =>  
    [products_id] =>
    [tag_cat_id] => 
    [tag_cat_name] =>
    [nw_eb_mz_art_type] =>
    [tag_cat_type] =>
    [plan_price] =>
)

[3] => Array
(
    [plan_id] => 2
    [plan_user_id] => 1
    [plan_title] => 6 months plan
    [plan_validity] => 180 days
    [plan_desc] => 180 days.
    [plan_activation] => 1
    [plan_status] => 1
    [banch_id] =>  
    [products_id] =>
    [tag_cat_id] => 
    [tag_cat_name] =>
    [nw_eb_mz_art_type] =>
    [tag_cat_type] =>
    [plan_price] =>
)

)

In Plan Table All plan is not Found in tag_category_banching table then After joining those field are not so match in tag_category_banching its data is blank like below array.

  • Possible duplicate of [What is the syntax for an inner join in LINQ to SQL?](https://stackoverflow.com/questions/37324/what-is-the-syntax-for-an-inner-join-in-linq-to-sql) – Anil Kumar Sahu Feb 26 '18 at 10:23

1 Answers1

0
$query = $this->db->query("SELECT * FROM table-one JOIN table-two ON table-1-id = table-2-id");
return $query->result();

Note:- JOIN and ON are keywords to get data of both tables

AND table-one and table-2 are your required tables

AND table-one-id and table-two-id are the column names of both tables for the join

Danish Ali
  • 2,354
  • 3
  • 15
  • 26