thinkPHP3表关联查询

WBOY
Release: 2016-06-13 12:35:47
Original
1029 people have browsed it

thinkPHP三表关联查询
三个表,r_hospital表    r_department表        r_doctor表
       id              id hospital_id        id depart_id  hospital_id
三个表所属关系如上,
两个表关联:我会了,
$condition['hospital_id'] = $data;
// 把查询条件传入查询方法
$result = $room->join('r_hospital on r_department.hospital_id=r_hospital.id')->where($condition)->select();  
求三个表关联语句?

$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(); 这语句不对,不知道哪有问题

thinkphp join 三表关联
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!