0
プロシージャの出力を1つのテーブルにまとめたい。実際にはHeidlSqlで実行しているときに複数のテーブルに出力を表示しています。結果を1つのテーブルに返す必要があるMysqlプロシージャ
DELIMITER //
create procedure daily_report()
BEGIN
select count(Transaction1) from test1 where (DATE1 between curdate() and curdate()+1);
select count(Transaction1) from test1 where RESPONSE='Y' and (DATE1 between curdate() and curdate()+1);
select (sum(RESPONSE='Y')/count(Transaction1))*100 from test1 where (DATE1 between curdate() and curdate()+1);
select count(Transaction1) from test1 where RESPONSE='N' and (DATE1 between curdate() and curdate()+1);
select (sum(RESPONSE='N')/count(Transaction1))*100 from test1 where (DATE1 between curdate() and curdate()+1);
select count(Transaction1),DATE1 from test1 where RESPONSE='N' and ERROR1='30' and (DATE1 between curdate() and curdate()+1);
select (sum(RESPONSE='N' AND ERROR1='30')/count(Transaction1))*100 from test1 where (DATE1 between curdate() and curdate()+1);
select count(Transaction1) from test1 where RESPONSE='N' and ERROR1 not like '30' and (DATE1 between curdate() and curdate()+1);
select (sum(RESPONSE='N' AND ERROR1 not like '30')/count(Transaction1))*100 from test1 where (DATE1 between curdate() and curdate()+1);
end
DELIMITER ;