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

推荐订阅源

S
SegmentFault 最新的问题
MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
The GitHub Blog
The GitHub Blog
博客园 - Franky
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
V
Visual Studio Blog
IT之家
IT之家
美团技术团队
博客园 - 司徒正美
Martin Fowler
Martin Fowler
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
Vercel News
Vercel News
雷峰网
雷峰网
B
Blog
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
D
Docker
P
Proofpoint News Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿

博客园 - BigRain

小学生学习汉字,汉字抓取 c# regex regextools cache 访问频率的思考 python 百度cpc点击 PPT辅助工具 检查外链的方法 webService启用cookie的另一种方法 百度调价HttpWebRequest 装饰者模式 第一个android程序闪亮登场 SQL 的一些批量插入和修改 职责链模式的运用 State Pattern 程序人生 SerialPort实现modem的来电显示 利用枚举进行状态的设计 singleton模式 在软件开发中的运用 我对当前项目的一些看法 闲话闲说——关于异常
20130118SQL记录
BigRain · 2013-01-18 · via 博客园 - BigRain

update l
set
l.state='X'
from
links l
inner join
(
select max(ID) as ID from links where [time]>'2013/1/1' and state<>'X' group by title having count(1)>5
) b
on l.id=b.id and 1=2


--具体重复的记录 l.id>=a.minID and l.id<=a.maxID 采用主键筛选,加快筛选效率
select l.ID,l.title,l.url,l.author,l.time,l.hospital,l.state,
a.maxId,a.MinID,a.repeat
from links l
,
(select title,max(ID) maxID,min(ID) minID,count(1) repeat
from links
where [time]>'2013/1/1'
group by title
having count(1) >3
)a
where l.id>=a.minID and l.id<=a.maxID and l.title=a.title
order by a.minID desc

select c.employee,
count(CASE WHEN c.hospital = '********' then 1 else null end) as 定州,
count(CASE WHEN c.hospital = '********' then 1 else null end) as 辛集,
count(CASE WHEN c.hospital = '********' then 1 else null end) as 任丘,
count(CASE WHEN c.hospital = '********' then 1 else null end) as 藁城,
count(CASE WHEN c.hospital = '********' then 1 else null end) as 安国
from customers c
where state='就诊'
and medicaled>='2012/12/1'
and medicaled<'2013/1/1'
group by employee
order by employee