Welcome Guest, Not a member yet? Register   Sign In
Searching three (or more) related tables; methods
#2

[eluser]pickupman[/eluser]
I believe you would want to join the products & vendors table to your tag table. Since you have many records for tags you could use:
Code:
$this->db->select('t.*, p.*, v.vendor_name');
$this->db->join('products p','p.id = t.product_id');
$this->db->join('vendors v' ,'v.id = p.vendor_id');
$this->db->like('p.field1', $keyword);
$this->db->or_like('p.field2', $keyword);
$this->db->or_like('p.field3', $keyword);
$this->db->or_like('t.tag', $keyword);
$this->db->or_like('v.vendor_name', $keyword);
$this->db->get('product_tags t');


Messages In This Thread
Searching three (or more) related tables; methods - by El Forum - 06-28-2010, 09:39 AM
Searching three (or more) related tables; methods - by El Forum - 06-28-2010, 11:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB