I\'m trying to do multiple selects from different tables in a mysql stored procedure as follows
DELIMITER //
CREATE PROCEDURE `NovemberSummary`(IN `branch` VA
Try This
CREATE PROCEDURE `NovemberSummary`(IN `branch` VARCHAR(60), IN `year` INT) NOT
DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER
BEGIN
DECLARE SalesAmount VARCHAR(255) DEFAULT 0;
DECLARE ExpensesAmount VARCHAR(255) DEFAULT 0;
SELECT SUM(sales.amount) AS Sales INTO SalesAmount FROM sales WHERE MONTH (sales.date)= 11 AND
sales.branch = branch;
SELECT SUM(expenses.amount) AS Expenses INTO ExpensesAmount FROM expenses WHERE MONTH(expenses.date)= 11
AND expenses.branch = branch;
SELECT SalesAmount AS Sales, ExpensesAmount AS Expenses;
END