我正在为我的项目制作程序,但我遇到了类似下面图片的问题。
这是我用mysql代码调用该程序但是它什么也没显示 当我用php管理界面执行它时,它返回我想要的结果
这是我的程序
DELIMITER //
CREATE PROCEDURE baocaodoanhthunam(IN nam integer)
BEGIN
DECLARE thang integer;
DECLARE countcb integer;
DECLARE doanhthu decimal;
SET @thang = 1;
create temporary table test_1 (thangg int, socb int, doanhthuu decimal);
while @thang <= 12
do
SELECT COUNT( * ), SUM(result.tonggiave) into @countcb, @doanhthu
FROM (
SELECT cb.MACHUYENBAY, SUM( ctdv.GIAVE ) AS tonggiave
FROM chuyenbay cb, dondatve ddv, chitietdatve ctdv, ve v
WHERE YEAR( cb.THOIGIANBAY ) = nam
AND MONTH( cb.THOIGIANBAY ) = @thang
AND ctdv.MAVE = v.MAVE
AND v.MACHUYENBAY = cb.MACHUYENBAY
AND ctdv.MADONDATVE = ddv.MADONDATVE
AND ddv.DATHANHTOAN =1
GROUP BY cb.MACHUYENBAY
) AS result;
insert into test_1 values (@thang, @countcb, @doanhthu);
set @thang = @thang + 1;
end while;
select t.thangg as 'Tháng', t.socb as 'Số chuyến bay', t.doanhthuu as 'Doanh thu' from test_1 t;
END //
DELIMITER ;
所以我的问题是在mysql 5.5中,是否支持创建临时表? 如果是的话,为什么我遇到这个问题? 谢谢大家帮助!我很感谢你的帮助。