mysql sql取交集数据

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/world_the_begin/article/details/80570369
SELECT * FROM
        PROGRAM p
        <if test="code != null and code != ''">
        INNER JOIN program_tag_map ptmarea ON (ptmarea.content_id = p.CONTENT_ID
           AND ptmarea.tag_id = #{code}
        )
        </if>
        <if test="categorys != null and categorys != ''">
        INNER JOIN program_tag_map ptmtype ON (ptmtype.content_id = p.CONTENT_ID
           AND ptmtype.tag_id = #{categorys}
        )
        </if>
        <if test="releaseYear != null and releaseYear != ''">
        INNER JOIN program_tag_map ptmyear ON (ptmyear.content_id = p.CONTENT_ID
           AND ptmyear.tag_id = #{releaseYear}
        )
        </if>

展开阅读全文

没有更多推荐了,返回首页