CLEAR
CREATE CURSOR Curtable(YS C(10),CM C (10),SL N(4))
INSERT INTO Curtable(YS,CM,SL) VALUES ('红色','M',10)
INSERT INTO Curtable(YS,CM,SL) VALUES ('红色','L',20)
INSERT INTO Curtable(YS,CM,SL) VALUES ('红色','XL',5)
INSERT INTO Curtable(YS,CM,SL) VALUES ('红色','XXL',28)
INSERT INTO Curtable(YS,CM,SL) VALUES ('红色','XXXL',37)
INSERT INTO Curtable(YS,CM,SL) VALUES ('兰色','M',34)
INSERT INTO Curtable(YS,CM,SL) VALUES ('兰色','L',24)
INSERT INTO Curtable(YS,CM,SL) VALUES ('兰色 ','XL',6)
INSERT INTO Curtable(YS,CM,SL) VALUES ('兰色 ','XXL',12)
INSERT INTO Curtable(YS,CM,SL) VALUES ('兰色','XXXL',45)
SELECT YS,SUM(IIF(CM='M',SL,0)) AS 'M',SUM(IIF(CM='L',SL,0)) AS 'L',;
SUM(IIF(CM='XL',SL,0)) AS 'XL',SUM(IIF(CM='XXL',SL,0)) AS 'XXL',;
SUM(IIF(CM='XXXL',SL,0)) AS 'XXXL';
FROM Curtable GROUP BY YS INTO CURSOR CUR_HEN
BROWSE
SELECT YS,'M' AS CM,M AS SL FROM CUR_HEN;
UNION ALL;
SELECT YS,'L' AS CM,L AS SL FROM CUR_HEN;
UNION ALL;
SELECT YS,'XL' AS CM,XL AS SL FROM CUR_HEN;
UNION ALL;
SELECT YS,'XXL' AS CM,XXL AS SL FROM CUR_HEN;
UNION ALL;
SELECT YS,'XXXL' AS CM,XXXL AS SL FROM CUR_HEN