我正在尝试从 mysql 存储过程中的不同表中进行多次选择,如下所示
DELIMITER //
CREATE PROCEDURE `NovemberSummary`(IN `branch` VARCHAR(60), IN `year` INT) NOT
DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER
BEGIN
select sum(sales.amount) as Sales from sales where month (sales.date)= 11 and
sales.branch = branch;
select sum(expenses.amount) as Expenses from expenses where month(expenses.date)= 11
and expenses.branch = branch;
END
Run Code Online (Sandbox Code Playgroud)
但它只返回第一个选择,因为结果集中只包含销售列。
MySQL 版本为 5.6.11 - MySQL 社区服务器