使用mysql存储过程,通过for循环进行多次union,将日期列转为行数据。
时间: 2024-05-04 07:15:28
浏览: 52
假设有以下表格:
```[mysql]([http]([http](https://geek.csdn.net/educolumn/68f28ca3131d47699e5902c5d3d74d51?spm=1055.2569.3001.10083)s://geek.csdn.net/educolumn/68f28ca3131d47699e5902c5d3d74d51?spm=1055.2569.3001.10083)s://geek.csdn.net/educolumn/184b56c51fd333211e6f2a08e35b0efe?spm=1055.2569.3001.10083)
CREATE TABLE sales (
id INT PRI[mar](https://geek.csdn.net/educolumn/60cf75c8a2751a72edf1b3281603bbf6?spm=1055.2569.3001.10083)Y KEY [auto](https://geek.csdn.net/educolumn/0ed23d107a440608894f63cac98e73fb?spm=1055.2569.3001.10083)_INCREMENT,
date DATE,
amount INT
```