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
)

 

posted @ 2014-02-12 20:18  yufenghou  阅读(276)  评论(0)    收藏  举报