Javascript 如果值不为NULL,则Codeigniter联接
我想要的代码是,如果我找到了字段数据,那么我想将该特定数据连接到另一个表Javascript 如果值不为NULL,则Codeigniter联接,javascript,php,codeigniter,join,Javascript,Php,Codeigniter,Join,我想要的代码是,如果我找到了字段数据,那么我想将该特定数据连接到另一个表 $this->db->select('*'); $this->db->from('userprofile'); $this->db->where('userId', $userId); $this->db->where('status', 1); $this->db->join('bodytype', 'bodytype.b
$this->db->select('*');
$this->db->from('userprofile');
$this->db->where('userId', $userId);
$this->db->where('status', 1);
$this->db->join('bodytype', 'bodytype.bodyTypeId = userprofile.bodyType');
$this->db->join('children', 'children.childrenId = userprofile.children');
$this->db->join('ethnticity', 'ethnticity.ethnticityId = userprofile.ethnicity');
$this->db->join('smoke', 'smoke.smokeId = userprofile.smoke');
$this->db->join('drink', 'drink.drinkId = userprofile.drink');
$query = $this->db->get();
return $query->result();
如果我得到userprofile.bodyType,然后运行bodyType joinquery。有什么方法可以处理它吗?从这个堆栈:
将此where子句添加到查询中
$this->db->where('bodyType is NOT NULL', NULL, FALSE);
尝试内部联接:
$this->db->join('bodytype', 'bodytype.bodyTypeId = userprofile.bodyType','inner');