I am writting a function in mysql.
I need to have sum of transactions from last 2 dates entered in the system
My below function is considering last max date but I wanted to consider last max 2 dates in my below query
Please help me fixing my query.
DECLARE totalCount INT;
Declare tranDate Date;
select max(Transactiondate) into tranDate from dailycount where countoftheday <>0;
select (sum(EmailTransCount)+ sum(posttranscount)) INTO totalCount
where countoftheday <>0
and transactiondate = tranDate;