I need a table to store all the working days. I dont like loop, so I tried sql. The following is the SQL I used.

insert into tb_working_days(data_date,day_type)
select DATE_ADD(data_date,INTERVAL (select count(1) from tb_working_days) day),"W"
from tb_working_days ;

At first, I insert one date into the table.

Then I run this sql once, I get two rows. Run once more, I get four rows, as so on.

after 10 runs, I get more than 1000 rows. the work is done.

The most interesting point is the sql after Interval, and it makes the magic. The db is smart enough to convert a set into a int. that is amazing.

最新文章

  1. 妈妈再也不用担心我找不到spring源码了!
  2. C# 版本的冒泡排序,包括该死的控制台读取
  3. 基于2d Tool Kit 精灵合图,动作生成工具
  4. Object-c 语言
  5. How to Notify Command to evaluate in mvvmlight
  6. 用C语言代码判别CPU的大小端模式
  7. Java WeakReference的理解与使用
  8. asp.net mvc4 Controller与Action执行过程的研究(学习笔记)
  9. vue写请求接口--请求参数的变量要在return里面声明
  10. linux中/etc/profile、/etc/profile.d/、/etc/bashrc、~/.bashrc、~/.bash_profile、~/.bash_logout的作用与区别
  11. SSL证书安装(Tomcat)腾讯云服务器
  12. 解析/proc/net/dev
  13. Codeforces Round #324 (Div. 2) E
  14. pachi 学习
  15. <基础> PHP 数组操作
  16. 10.Mysql索引
  17. Mybatis笔记三:MyBatis的API文档
  18. 【leetcode】804
  19. ftp之心脏病
  20. tyvj P3737 逐个击破

热门文章

  1. 14.7.1&14.7.2
  2. 51. N-Queens (Array; Back-Track, Bit)
  3. UVa 12100 Printer Queue(queue或者vector模拟队列)
  4. linux-radhat-gitlab服务搭建
  5. 面向对象 Java练习
  6. [PHP] constant variable
  7. UI设计必用工具 — AI快捷键大全
  8. 连接数据库-corina
  9. 8个设计师必看的免费UI图标设计资源站
  10. javax.mail 发送邮件 , greenMail 测试 , spring