![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
sql
Programmer_FuQiang
解决不了问题,就把提出问题的人解决掉!
展开
-
sql 按照季度进行分组
selectcase when month(date) =1 or month(date) =2 or month(date)=3 then '一季度'when month(date) =4 or month(date) =5 or month(date)=6 then '2季度'when month(date) =7 or month(date) =8 or month(date)=9 ...原创 2021-08-03 14:58:22 · 1977 阅读 · 0 评论 -
sql 按照某个字段去重
select * from 表 where id in (select max(id) from 表 group by 去重字段)eg:select * from planthr_info where id in (select max(id) from planthr_info group by name)原创 2020-04-27 16:44:43 · 4254 阅读 · 0 评论 -
sql 四舍五入两种函数(三种方式)
select cast(3.14459 asnumeric(18,2)) 结果为:3.14selectconvert(decimal(18, 2), 3.14559)结果为:3.15select cast(3.14159 as decimal(10, 2))结果为:3.14原创 2017-12-27 13:22:04 · 10034 阅读 · 0 评论 -
Sql时间函数
一、sql server日期时间函数Sql Server中的日期与时间函数 1. 当前系统日期、时间 select getdate() 2. dateadd 在向指定日期加上一段时间的基础上,返回新的 datetime 值 例如:向日期加上2天 select dateadd(day,2,'2004-10-15') --返回:2004-10-17 00原创 2018-01-31 10:41:45 · 378 阅读 · 0 评论 -
sql日期转换
SQL 标量函数-----日期函数 day() 、month()、year()select day(createtime) fromlife_unite_product --取时间字段的天值select month(createtime) fromlife_unite_product --取时间字段的月值select year(createtime) fromlife_un原创 2018-01-31 10:48:52 · 1075 阅读 · 0 评论 -
关于数据库或者任何语言代码中 LT,LE,EQ,NE,GE,GT分别表示什么经常有人混淆,现如下解释:
关于数据库或者任何语言代码中 LT,LE,EQ,NE,GE,GT分别表示什么经常有人混淆,现如下解释: lt:less than 小于 le:less than or equal to 小于等于 eq:equal to 等于 ne:not equal to 不等于 ge:greater than or equal to 大于等于 gt:g...原创 2019-03-12 11:18:28 · 11765 阅读 · 1 评论