zoukankan      html  css  js  c++  java
  • 20130118SQL记录

    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

  • 相关阅读:
    JetBrains下载历史版本
    php入门笔记
    Ajax获取服务器信息
    Ubuntu上安装PHP环境-mysql+apache+php-Linux操作系统
    Ubuntu彻底删除/卸载mysql,php,apache
    轻松理解JS基本包装对象
    JS事件委托
    浅谈JS事件冒泡
    JS闭包那些事
    浅谈JS的变量提升
  • 原文地址:https://www.cnblogs.com/Linjianyu/p/2866762.html
Copyright © 2011-2022 走看看