我想结合这三个sql查询
SELECT homeupload, COUNT(*) FROM link GROUP BY homeupload
SELECT mediaType, COUNT(*) FROM link GROUP BY mediaType
SELECT emailSub, COUNT(*) FROM link WHERE emailSub='1' GROUP BY emailSub
进入单个查询。这可能吗?
答案 0 :(得分:4)
尝试使用UNION
SELECT homeupload, COUNT(*) FROM link GROUP BY homeupload
UNION
SELECT mediaType, COUNT(*) FROM link GROUP BY mediaType
UNION
SELECT emailSub, COUNT(*) FROM link WHERE emailSub='1' GROUP BY emailSub