mysql常用sql语句
来源:互联网 发布:英制螺纹如何编程 编辑:程序博客网 时间:2024/06/06 09:43
札记
查询当前这周的数据
SELECT name,submittime FROM enterprise WHERE YEARWEEK(date_format(submittime,’%Y-%m-%d’)) = YEARWEEK(now());
查询上周的数据
SELECT name,submittime FROM enterprise WHERE YEARWEEK(date_format(submittime,’%Y-%m-%d’)) = YEARWEEK(now())-1;
查询当前月份的数据
select name,submittime from enterprise where date_format(submittime,’%Y-%m’)=date_format(now(),’%Y-%m’)
查询距离当前现在6个月的数据
select name,submittime from enterprise where submittime between date_sub(now(),interval 6 month) and now();
查询上个月的数据
select name,submittime from enterprise where date_format(submittime,’%Y-%m’)=date_format(DATE_SUB(curdate(), INTERVAL 1 MONTH),’%Y-%m’)
select * from user
where DATE_FORMAT(pudate,’%Y%m’) = DATE_FORMAT(CURDATE(),’%Y%m’) ;
select * from user where WEEKOFYEAR(FROM_UNIXTIME(pudate,’%y-%m-%d’)) = WEEKOFYEAR(now())
select *
from user
where MONTH(FROM_UNIXTIME(pudate,’%y-%m-%d’)) = MONTH(now())
select *
from [user]
where YEAR(FROM_UNIXTIME(pudate,’%y-%m-%d’)) = YEAR(now())
and MONTH(FROM_UNIXTIME(pudate,’%y-%m-%d’)) = MONTH(now())
select *
from [user]
where pudate between 上月最后一天
and 下月第一天
常用的Mysql命令行操作语句大全
整理MySql常用查询语句(23种)
mysql sql命令行常用语句大全
mysql查询今天、昨天、上周
MYSQL中取当前周/月/季/年的第一天与最后一天
date_format()
date_format日期格式化
MySql查询时间段优化
Data source rejected establishment of connection, message from server: “Too many connections”问题:
太多的连接数,登录用户过多问题
- mysql常用SQL语句
- mysql常用SQL语句
- MySQL常用SQL语句
- MySql 常用Sql语句
- MySql 常用Sql语句
- MySql 常用SQL语句
- MySQL常用SQL语句
- Mysql 常用sql语句
- mysql 常用sql语句
- MySQL 常用SQL语句
- MySQL 常用sql语句
- Mysql 常用sql语句
- MySQL常用SQL语句
- MySQL常用SQL语句
- Mysql常用SQL语句
- MySQL常用sql语句
- MySQL常用SQL语句
- mysql常用sql语句
- NYOJ 笨蛋的难题(四)(排列比较)
- git 常用命令
- jmeter源码集成eclipse
- 设计模式之观察者模式篇
- 经典笔试题—— 判断两个字符串是否为旋转词
- mysql常用sql语句
- deadline_timer使用说明
- hibernate二级缓存作用、配置
- [服务器搭建]ISAPI和CGI限制中没有ASP.NET v4.0
- 【Python2.7 学习笔记】Python 基础(二)
- Shader First
- 前端-form提交前验证事件
- Kotlin应用于项目踩过的坑
- Android 把YUV420P格式的数据转换为RGB565格式