多表查询筛选性别男 学历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;
网友评论