赞
踩
- SELECT
- a.id,
- a.create_name,
- a.create_time,
- b.id AS bId,
- b.charge_key,
- b.check_status
- FROM
- patient_check_list a
- LEFT JOIN patient_check_item b ON b.business_id = a.id
主表和子表通过LEFT JOIN 关联后,主表以重复的方式对应多条右表记录。
- SELECT
- a.id,
- a.create_name,
- a.create_time,
- b.id AS bId,
- b.charge_key,
- b.check_status
- FROM
- patient_check_list a
- LEFT JOIN ( SELECT id, business_id, charge_key, check_status FROM patient_check_item GROUP BY business_id ) b ON b.business_id = a.id
- SELECT
- a.id,
- a.create
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。