ExcelTip.Net留存知识帖 ---【注:附件之前被网盘供应商清空后,现已修复-现已修复-现已修复为本地下载!】
现在位置:首页 > E文精选 > SQL in Excel > SQL简单万年历

SQL简单万年历

作者:绿色风 分类: 时间:2022-08-17 浏览:126
楼主
wudixin96
Q:EXCEL中能不能用SQL做个简单的万年历呢?A:请看
  1. transform first(日) select null from (select CHOOSE(WEEKDAY(日期),"日","一","二","三","四","五","六") as 星期,datepart("ww",日期) as 周,日 FROM (select (select f1 from [sheet1$d1:d1])&"/"&日&"/"&(select f1 from [sheet1$b1:b1]) as 日期,日 from (
  2. select 1 as 日 from [Sheet1$b1:b1] union
  3. select 2 from [Sheet1$b1:b1] union
  4. select 3 from [Sheet1$b1:b1] union
  5. select 4 from [Sheet1$b1:b1] union
  6. select 5 from [Sheet1$b1:b1] union
  7. select 6 from [Sheet1$b1:b1] union
  8. select 7 from [Sheet1$b1:b1] union
  9. select 8 from [Sheet1$b1:b1] union
  10. select 9 from [Sheet1$b1:b1] union
  11. select 10 from [Sheet1$b1:b1] union
  12. select 11 from [Sheet1$b1:b1] union
  13. select 12 from [Sheet1$b1:b1] union
  14. select 13 from [Sheet1$b1:b1] union
  15. select 14 from [Sheet1$b1:b1] union
  16. select 15 from [Sheet1$b1:b1] union
  17. select 16 from [Sheet1$b1:b1] union
  18. select 17 from [Sheet1$b1:b1] union
  19. select 18 from [Sheet1$b1:b1] union
  20. select 19 from [Sheet1$b1:b1] union
  21. select 20 from [Sheet1$b1:b1] union
  22. select 21 from [Sheet1$b1:b1] union
  23. select 22 from [Sheet1$b1:b1] union
  24. select 23 from [Sheet1$b1:b1] union
  25. select 24 from [Sheet1$b1:b1] union
  26. select 25 from [Sheet1$b1:b1] union
  27. select 26 from [Sheet1$b1:b1] union
  28. select 27 from [Sheet1$b1:b1] union
  29. select 28 from [Sheet1$b1:b1] union
  30. select 29 from [Sheet1$b1:b1] union
  31. select 30 from [Sheet1$b1:b1] union
  32. select 31 from [Sheet1$b1:b1])
  33. ) where isdate(日期)
  34. ) group by 周 pivot "星期"&星期 in ("星期日","星期一","星期二","星期三","星期四","星期五","星期六")
s.gif
 
2楼
zzmxy

牛人啊,當年能做出來的兩個人中,
其中一位就是無敵哥哥啊~~~
3楼
君柳
佩服的WTTD啊
4楼
wise

佩服**哥
5楼
raulerini
崇拜ing~~~。
6楼
海洋之星
厉害啊,学习学习
7楼
wjc2090742
厉害,学习了,好题目。
8楼
水星钓鱼
精华
9楼
yanzezhou
看不懂
10楼
海洋之星
厉害啊,学习学习
11楼
xiongxh
星期会随月份变吗

免责声明

有感于原ExcelTip.Net留存知识的价值及部分知识具有的时间限定性因素, 经与ExcelTip.Net站长Apolloh商议并征得其同意, 现将原属ExcelTip.Net的知识帖采集资料于本站点进行展示, 供有需要的人士查询使用,也慰缅曾经的论坛时代。 所示各个帖子的原作者如对版权有异议, 可与本人沟通提出,或于本站点留言,我们会尽快处理。 在此,感谢ExcelTip.Net站长Apolloh的支持,感谢本站点所有人**绿色风(QQ:79664738)**的支持与奉献,特此鸣谢!
------本人网名**KevinChengCW(QQ:1210618015)**原ExcelTip.Net总版主之一

评论列表
sitemap