【发布时间】:2025-12-27 13:05:12
【问题描述】:
我有这个存储过程。如何选择一个变量作为可以在 sp 的每一行结果中 +1 值的字段?我需要它来制作一个虚拟 id 字段。请帮帮我。
CREATE DEFINER=`root`@`localhost` PROCEDURE `customer_order$count_order_by_month`()
BEGIN
select count(1) as amount, month(created_date) as months, year(created_date) as years
from customer_order
group by { fn month(created_date) }, MONTH(created_date), YEAR(created_date)
order by Year(created_date), month(created_date);
END
【问题讨论】:
标签: mysql sql stored-procedures