CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_printnotprintdailyexpenses`(
in i_localBodyId varchar(10),
in i_epId int(20),
out printed INT(20),
out notprinted INT(20)
)
BEGIN
set printed=(select count(isPrinted) from tbl_dailyExpenses
where date((curdate() - 7)) and date(curdate())and
localBodyId =i_localBodyId and epId=i_epId and isPrinted=1 group by CURDATE()-7 );
set notprinted=(select count(isPrinted) from tbl_dailyExpenses
where date((curdate() - 7 )) and date(curdate())and
localBodyId =i_localBodyId and epId=i_epId and isPrinted=0 group by CURDATE()-7 );
END
1条答案
按热度按时间y53ybaqx1#
我认为你不需要做手术。一个简单的查询就足够了。根据我对这个问题(以及你问的另一个问题)的理解,这应该会给你想要的结果:
在这个查询中,需要用要测试的值替换i\u localbodyid和i\u epid。