美文网首页
多表联合查询

多表联合查询

作者: 茶饭不思 | 来源:发表于2024-04-24 10:17 被阅读0次

    多表查询筛选性别男 学历XX以上,年龄在XX以上

    SELECT id, name, mobile
    FROM (
        SELECT id, name, mobile
        FROM fa_miniform_ypzbmjf
        WHERE sex = 1
        AND xueli <= 5
        AND TIMESTAMPDIFF(YEAR, birthday, CURDATE()) < 35
    
        UNION
    
        SELECT id, name, mobile
        FROM fa_miniform_fangxunqx
        WHERE sex = 1
        AND xueli <= 5
        AND TIMESTAMPDIFF(YEAR, birthday, CURDATE()) < 35
    
        UNION
    
        SELECT id, name, mobile
        FROM fa_miniform_yjglxgy
        WHERE sex = 1
        AND xueli <= 5
        AND TIMESTAMPDIFF(YEAR, birthday, CURDATE()) < 35
    
    ) AS combined_results
    GROUP BY mobile;
    

    相关文章

      网友评论

          本文标题:多表联合查询

          本文链接:https://www.haomeiwen.com/subject/vgxgxjtx.html