我想将此查询合并为一个,以按日期返回 2 个值(“scount_atp”,其中 estado=1 和“scount_xxx”,其中 estado=4):
SELECT DATE_FORMAT(FROM_UNIXTIME(fecha),"%m-%d-%Y") as sdate, COUNT(id) as scount_atp FROM entradas WHERE estado = '1' AND fecha <= UNIX_TIMESTAMP(NOW()) AND fecha >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 YEAR)) GROUP BY sdate
SELECT DATE_FORMAT(FROM_UNIXTIME(fecha),"%m-%d-%Y") as sdate, COUNT(id) as scount_xxx FROM entradas WHERE estado = '4' AND fecha <= UNIX_TIMESTAMP(NOW()) AND fecha >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 YEAR)) GROUP BY sdate
我是 MySQL 的新手,所以如果这太基本了,我很抱歉......
谢谢大家的帮助!