我是mysql的新手,我在phpmyadmin中编写以下函数:
BEGIN
declare @var1 int;
declare @var2 int;
set @var1 = 0;
set @var2 = 0;
count(*)
into @var1
from transactions
where reg_date > DATE_SUB(CURDATE(),INTERVAL 90 DAY)
and reg_date <= CURDATE() = last_transactions;
count(*)
into @var2
from account
where exp_date > CURDATE()
AND reg_date > DATE_SUB(CURDATE(),INTERVAL 90 DAY);
return @var2/@var1;
END
我总是收到1064错误。 提前谢谢。
答案 0 :(得分:0)
BEGIN
declare @var1 int;
declare @var2 int;
set @var1 = 0;
set @var2 = 0;
select count(*) as count into @var1
from transactions
where reg_date > DATE_SUB(CURDATE(),INTERVAL 90 DAY)
and reg_date <= CURDATE() = last_transactions;
select count(*) as count into @var2
from account
where exp_date > CURDATE()
AND reg_date > DATE_SUB(CURDATE(),INTERVAL 90 DAY);
return @var2/@var1;
END