惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
Lohrmann on Cybersecurity
K
Kaspersky official blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Palo Alto Networks Blog
Scott Helme
Scott Helme
P
Proofpoint News Feed
量子位
S
Schneier on Security
AWS News Blog
AWS News Blog
N
Netflix TechBlog - Medium
T
Threat Research - Cisco Blogs
T
Threatpost
Cisco Talos Blog
Cisco Talos Blog
L
LINUX DO - 热门话题
T
The Exploit Database - CXSecurity.com
A
Arctic Wolf
S
Securelist
T
Tailwind CSS Blog
T
Tor Project blog
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
I
InfoQ
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cisco Blogs
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tenable Blog
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
V
Visual Studio Blog
博客园 - 叶小钗
F
Full Disclosure
Know Your Adversary
Know Your Adversary
N
News and Events Feed by Topic
Engineering at Meta
Engineering at Meta
S
SegmentFault 最新的问题
The Last Watchdog
The Last Watchdog
H
Hacker News: Front Page
阮一峰的网络日志
阮一峰的网络日志
D
Docker
Spread Privacy
Spread Privacy
T
The Blog of Author Tim Ferriss
S
Security @ Cisco Blogs
Attack and Defense Labs
Attack and Defense Labs
MyScale Blog
MyScale Blog
腾讯CDC
Recent Announcements
Recent Announcements
Stack Overflow Blog
Stack Overflow Blog

博客园 - 左少白

oracle 找回DROP掉的表 求解,工作流点通过时,弹出窗口让用户录入审核意见 oracle 游标 c# 多态 c# 继承 查询行转列 SqlParameter序列化的问题 oracle oracle trunc (date,dd )函数 oracle 游标 对象集合转换为datatable 用C# 正则 提取HTML标签中的值? oracle decode 与 case when ,空的处理 oracle select for update sql1 同期进度,完成率 Oracle Index 相關知識 玩转DevExpress.XtraGrid.view.gridview oracle索引 在Oracle中进行大小写不敏感的查询2
sqlserver 按五分钟分组
左少白 · 2012-04-06 · via 博客园 - 左少白

create table tb(时间 datetime , 金额 int)  

insert into tb values('2007-1-1 10:00:23' ,          8 ) 

insert into tb values('2007-1-1 10:01:24' ,          4 ) 

insert into tb values('2007-1-1 10:05:00' ,          2 ) 

insert into tb values('2007-1-1 10:06:12' ,          3 )

insert into tb values('2007-1-1 10:08:00' ,          1 )

insert into tb values('2007-1-1 10:12:11' ,          5 )  go   

最简单方法,把datetime转成float型(单位整数部分为天),然后乘24*60/5,就是整数部分是5分钟了,然后取整就行了

用这种方法做,随便你算几分钟的分组都能算

select cast(floor(cast(时间 as float)*24*60/5)*5/60/24 as smalldatetime),SUM(金额)

from tb

group by cast(floor(cast(时间 as float)*24*60/5)*5/60/24 as smalldatetime)