I am creating a procedure that returns a total amount of sales between two dates, which the user puts in. It's sloppy code, I think, but I cannot get it to run and I've already changed it many times. I'm worried that I am moving futher from the answer rather than closer. Here is my code:
DELIMITER //
CREATE PROCEDURE salesBetween (IN date1(date), date2(date),
OUT totalsale(decimal(10,2)))
BEGIN
SELECT SUM(hslineitem.numOrdered * hslineitem.price)
FROM hslineitem, hsorders
WHERE hsorders.orderId = hslineitem.orderId
AND (hsorders.orderDate BETWEEN date1 AND date2)
AND orderdate = date1, date2;
END //
DELIMITER ;
THis is the first time I've tried to use more than one piece of user input, so I am guessing my issue has to do with that. Most everything I can find online is not mysql specific, so it hasn't been much help.