Welcome Guest, Not a member yet? Register   Sign In
Join multi other table
#1

[eluser]haily_php[/eluser]
I have 4 table in database, now, I want to select all data from those 4 table. And my code:
Code:
$this->db->select("*");
  $this->db->join("tableB", "tableB.ID_B=product.ID_B');

  $this->db->join("DetailBill","DetailBill.ID_SP=product.idthanhvien");
  
  return $data=$this->db->get("product")->result_array();

And, result is an array that I want (because "Table B" table and "Detail Bill" table relate to "Product" table, but I want to take data from one more table (Table A). Table A only relate to Table B
Code:
$this->db->select("*");
  
  $this->db->join("tableA", "tableA.ID_A=tableB.ID_A');  

  $this->db->join("tableB", "tableB.ID_B=product.ID_B');

  $this->db->join("DetailBill","DetailBill.ID_SP=product.idthanhvien");
  
  return $data=$this->db->get("product")->result_array();

I don't know what do I do to join "Table A" to take data.


Sorry, my english is not well


Messages In This Thread
Join multi other table - by El Forum - 05-27-2011, 03:40 AM
Join multi other table - by El Forum - 05-27-2011, 08:59 AM
Join multi other table - by El Forum - 08-15-2011, 01:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB