sql 关联查询

SELECT mms_sample_datas.* from 

mms_sample_datas

where


mms_sample_datas.mms_id

in

(
        SELECT
            mms_sample_datas.mms_id
        FROM
            mms_sample_datas
        INNER JOIN mms_text_datas ON mms_sample_datas.uuid = mms_text_datas.mms_uuid
        AND mms_text_datas.is_repair_audit = 1
        UNION
            SELECT
                mms_sample_datas.mms_id
            FROM
                mms_sample_datas
            INNER JOIN mms_pic_datas ON mms_sample_datas.uuid = mms_pic_datas.mms_uuid
            AND mms_pic_datas.is_repair_audit = 1
)
原文地址:https://www.cnblogs.com/yufenghou/p/3546564.html