zoukankan      html  css  js  c++  java
  • SQL

    select t.id,t.name,(case when u.dt is null then t.dt else u.dt end)as updatedt from testta t left join
    (select id,max(dt) as dt from updatedate group by id) as u on t.id=u.id
    dt是时间

    删除列:alter table testta drop column dt2
    添加列及默认值:alter table testta add dt2 datetime constraint dt2 (default getdate() with values)

    哪一月的每一天的数量是:
    select convert(char(11),dt2),count(id) from testta where dt2 between convert(datetime,'04 01 2006') and convert(datetime,'05 01 2006')
    group by convert(char(11),dt2)
    convert(char(11),dt2):只取年月日

    分页语句:
    SELECT TOP pagesize * FROM articles
    WHERE id NOT IN ( SELECT TOP ( pagesize * pageindex ) id FROM articles ORDER BY id DESC )
    ORDER BY id DESC
    pagesize:每页显示几条
    pageindex:第几页

    replace(字段名,char(13),'') 将字段中的回车符替换成为空

  • 相关阅读:
    docker
    opencart
    Why is setTimeout(fn, 0) sometimes useful?
    linux下php环境配置
    xampp for linux
    Where to go from here
    freefcw/hustoj Install Guide
    khan academy js
    SDWebImage
    基于OpenCV 的iOS开发
  • 原文地址:https://www.cnblogs.com/pretty/p/1276622.html
Copyright © 2011-2022 走看看