1.根据出生日期计算当前已满周岁

DECLARE @birth datetime
SET @birth='1990-01-01'
SELECT (cast(convert(char( 8 ),GETDATE(),112) as int) - cast(convert(char(8),@birth,112) as int))/10000

2.COUNT(expression) just returns the total number of rows in which that expression is not null.

COUNT函数返回值不为null的行数。

ID FullName
1 NULL
2 NULL
SELECT COUNT(1) FROM t1 -- Returns 2
SELECT COUNT(FullName) FROM t1 -- Returns 0
COUNT(expression) just returns the total number of rows in which that expression is not null. - See more at: http://www.sqlteam.com/article/how-to-use-group-by-in-sql-server#sthash.b6O058Mg.dpuf

(持续更新中)

最新文章

  1. 利用Jquery获取、设置iframe中元素
  2. Twentydaysgone
  3. oracle中merge方法
  4. R12.2 URL Validation failed. The error could have been caused through the use of the browser's navigation buttons
  5. WaitForMultipleObjects返回失败原因之一
  6. 【转】bind - DNS 設定
  7. iOS10权限声明国际化
  8. [css] 【转载】 精简高效的CSS命名准则/方法
  9. SQL查询(笔记2——实体查询)
  10. CSS 样式二
  11. php拓展ssh功能
  12. 在Azure Cloud Service中部署Java Web App(2)
  13. MySQL分区表的局限和限制
  14. Openning
  15. linux atoi
  16. ios安装ipa与安卓安装apk
  17. C# EF 与 MySql 的那些坑
  18. Python Number 类型转换
  19. mysql 5.7 基于GTID 主从同步的1236故障处理(其它事务故障等同)
  20. SpringMVC工作原理详解

热门文章

  1. scala,import test._ ; import test.{ClassA,ClassB}
  2. ES6里关于模板字面量的拓展
  3. go语言的一些特性
  4. 2017.9.5 postgresql加密函数的使用
  5. 使用PowerDesigner进行代码生成
  6. mysql中show processlist过滤和杀死线程
  7. SQL语句练习手册--第二篇
  8. Layer 初始
  9. axios 处理并发请求
  10. 【转】mongoDB命令行和客户端访问