我有四个表,分别名为tblproducts,tblprospecification,tblcomspecification和tblledtvpecification。
tblproducts的字段为proid,product_code,product_name, pro_img,pro_resize_img,pro_thumb_img及其存储产品 详细信息。
第二个表是tblprospecification,它存储移动设备规范,它具有列speid,proid,in_the_box,model_number,model_name,color,browse_type,sim_type。
我正在使用下面的查询输入
$query= $this->db->select( 'tblproducts.proid as pro_id, product_code, product_name, pro_img, pro_resize_img, pro_thumb_img, tblprospecification.proid as product_id , in_the_box ,model_number, model_name, tblprospecification.color as mobile_color, browse_type, sim_type ,tblcomspecification.proid as product_id, tblcomspecification.modelname as com_moledname, series, tblcomspecification.color as com_color, tblledtvpecification.proid, tblledtvpecification.modelname as ledtv_modelname, dsize,stype_id, hd_techno')
->from('tblproducts')
->join('tblprospecification','tblproducts.proid = tblprospecification.proid ' ,'left')
->join('tblcomspecification','tblproducts.proid = tblcomspecification.proid', 'left')
->join('tblledtvpecification','tblproducts.proid = tblledtvpecification.proid' ,'left')
->where('tblproducts.proid',$proid)
->get();
return $query->result();
执行查询时,它将仅从tblproducts和tblprospecification联接后返回数据。它会返回空白数据以进行tblledtvpecification,tblcomspecification。