#2
xianfajushi2020-03-25 11:11
|
SELECT '2019-01' AS Month, 'YT' AS BIZ, 'AP' AS Region, 100.90 AS Revenue
INTO T
UNION ALL
SELECT '2019-01' AS Month, 'ZY' AS BIZ, 'AP' AS Region, 200.90 AS Revenue
UNION ALL
SELECT '2019-01' AS Month, 'AIO' AS BIZ, 'AP' AS Region, 300 AS Revenue
UNION ALL
SELECT '2019-01' AS Month, 'XY' AS BIZ, 'AP' AS Region, 400 AS Revenue
UNION ALL
SELECT '2019-01' AS Month, 'AA' AS BIZ, 'AP' AS Region, 250 AS Revenue
UNION ALL
SELECT '2019-01' AS Month, 'BB' AS BIZ, 'AP' AS Region, 900 AS Revenue
UNION ALL
SELECT '2019-01' AS Month, 'XY' AS BIZ, 'EMEA' AS Region, 400 AS Revenue
UNION ALL
SELECT '2019-01' AS Month, 'AA' AS BIZ, 'EMEA' AS Region, 250 AS Revenue
UNION ALL
SELECT '2019-01' AS Month, 'BB' AS BIZ, 'EAEA' AS Region, 900 AS Revenue
UNION ALL
SELECT '2019-02' AS Month, 'AIO' AS BIZ, 'AP' AS Region, 300 AS Revenue
UNION ALL
SELECT '2019-02' AS Month, 'XY' AS BIZ, 'AP' AS Region, 400 AS Revenue
UNION ALL
SELECT '2019-02' AS Month, 'AA' AS BIZ, 'AP' AS Region, 250 AS Revenue
UNION ALL
SELECT '2019-02' AS Month, 'BB' AS BIZ, 'AP' AS Region, 900 AS Revenue
UNION ALL
SELECT '2019-02' AS Month, 'AIO' AS BIZ, 'EMEA' AS Region, 200 AS Revenue
UNION ALL
SELECT '2019-02' AS Month, 'XY' AS BIZ, 'EMEA' AS Region, 100 AS Revenue
UNION ALL
SELECT '2019-02' AS Month, 'AA' AS BIZ, 'EMEA' AS Region, 700 AS Revenue
UNION ALL
SELECT '2019-02' AS Month, 'BB' AS BIZ, 'EMEA' AS Region, 300 AS Revenue
UNION ALL
SELECT '2019-03' AS Month, 'AIO' AS BIZ, 'AP' AS Region, 300 AS Revenue
UNION ALL
SELECT '2019-03' AS Month, 'XY' AS BIZ, 'AP' AS Region, 400 AS Revenue
UNION ALL
SELECT '2019-03' AS Month, 'AA' AS BIZ, 'AP' AS Region, 250 AS Revenue
UNION ALL
SELECT '2019-03' AS Month, 'BB' AS BIZ, 'AP' AS Region, 900 AS Revenue
建表以后,
求月,地区,总值,平均值(相同区域跨月的平均)
下面的表格是期待的结果,数据略有出入,但大体的意思如图所示
谢谢
只有本站会员才能查看附件,请 登录