计算年龄
SELECT FLOOR(FLOOR(DATEDIFF(NOW(),create_time))/365+1) FROM tb_task
SELECT
u.*,
GROUP_CONCAT(r.nameZh) nameZhs,
GROUP_CONCAT(r.id) rids,
p.province provinceName,
c.city cityName,
d.district districtName
FROM
USER u
LEFT JOIN nation p
ON u.province = p.id
LEFT JOIN nation c
ON u.city = c.id
LEFT JOIN nation d
ON u.district = d.id
LEFT JOIN user_role ur
ON u.id = ur.uid
LEFT JOIN role r
ON ur.rid = r.id
GROUP BY u.id
HAVING FIND_IN_SET(“18”,rids) AND
FIND_IN_SET(“1”, rids)
AND FIND_IN_SET(“3”, rids)