$result = $room->join('r_hospital on r_department.hospital_id=r_hospital.id')->where(array('hospital_id'=>array('exp','is not null')))->select();
大神们看看,where(array('hospital_id'=>array('exp','is not null')))这句话是什么意思?结果显示出来所有的医院,但我只想查某一个,把医院id等于$data,怎么做
thinkphp 关联查询
------解决方案--------------------
$condition['hospital_id'] = $data;
// 把查询条件传入查询方法
$result = $room->join('left join r_hospital on r_department.hospital_id=r_hospital.id left join doctor on doctor.id = xx.id')->where($condition)->select();