mysql 日期 格式化 加减
2015-09-25 14:15
477 查看
(SELECT date_format(date_add(now(),interval 0 year), '%Y') code, CONCAT(date_format(date_add(now(),interval 0 year), '%Y'),'年') name) UNION (SELECT date_format(date_add(now(),interval -1 MONTH), '%Y-%m') code, CONCAT(date_format(date_add(now(),interval -1 year), '%Y'),'年') name) UNION (SELECT date_format(date_add(now(),interval -2 year), '%Y') code, CONCAT(date_format(date_add(now(),interval -2 year), '%Y'),'年') name) UNION (SELECT date_format(date_add(now(),interval -3 year), '%Y') code, CONCAT(date_format(date_add(now(),interval -3 year), '%Y'),'年') name) UNION (SELECT date_format(date_add(now(),interval -4 year), '%Y') code, CONCAT(date_format(date_add(now(),interval -4 year), '%Y'),'年') name)
结果: code name
2015 2015年
2015-08 2014年
。。。。。
相关文章推荐
- ubuntu安装mysqldb
- loadrunner数据库MySQL参数化列表乱码问题
- MySql中添加用户,新建数据库,用户授权,删除用户,修改密码
- 分享三:mysql跨库查询
- mysql主从 配置
- [MySQL]导入导出
- MySql的主从配置
- [MySQL]安装和启动
- [MySQL]命令行工具和基本操作
- mysql备份策略
- MySQL索引原理及慢查询优化
- 100%成功 mysql高版本导入低版本数据库
- 我的mysql学习心得
- 高性能mysql(二) 高性能索引
- mysql-模拟全连接处理
- lnmp下如何关闭Mysql日志保护磁盘空间
- mysql 事物小测试
- mysql合理配置连接池数量
- mysql触发器实践
- RMySQL