the important thing is not to stop questioning

导航

 

2015年10月27日

摘要: 方式一select top @pageSize * from company where id not in(select top @pageSize*(@pageIndex-1) id from company)方式二ROW_NUMBER()OVER--ROW_NUMBER() 就是生成一个有顺序... 阅读全文
posted @ 2015-10-27 16:48 qook 阅读(108) 评论(0) 推荐(0) 编辑
 
摘要: --sql2000select序号=(selectcount(1)fromtbwhere学号<t.学号)+1,学号,姓名fromtbt--sql2005select序号=row_number()over(orderby学号),学号,姓名fromtb 阅读全文
posted @ 2015-10-27 16:44 qook 阅读(199) 评论(0) 推荐(0) 编辑
 
摘要: 在设置列的别名时,有两种方式:ct=count(*)count(*)asct可省略为了count(*)ct作用是等价的. 阅读全文
posted @ 2015-10-27 16:43 qook 阅读(191) 评论(0) 推荐(0) 编辑
 
摘要: sql中as的用法和一些经典的sql语句2008-08-21 21:55总结一些工作中用到或碰到的SQL语句,希望能与大家分享,同时也希望大家能提供更多的精妙SQL语句.....1、delete table1 from (select * from table2) as t2 where table... 阅读全文
posted @ 2015-10-27 16:42 qook 阅读(151) 评论(0) 推荐(0) 编辑
 
摘要: 1、拼接查询语句(SQL2000,2005,2008均可) DECLARE @a AS INT SET @a=1 EXEC('SELECT TOP '+@a+' * FROM mtrcLanguages') 2、直接使用(适用SQL2005以上) DECLARE @a AS INT SE... 阅读全文
posted @ 2015-10-27 16:40 qook 阅读(205) 评论(0) 推荐(0) 编辑
 
摘要: select distinct top 3 from table;先distinct后top 阅读全文
posted @ 2015-10-27 16:39 qook 阅读(179) 评论(0) 推荐(0) 编辑
 
摘要: Subquery typo with using inDo you use the following syntax?SELECT * FROM TABLE WHERE COLUMN IN (SELECT COLUMN FROM TABLE)OR this?SELECT * FROM T... 阅读全文
posted @ 2015-10-27 14:24 qook 阅读(149) 评论(0) 推荐(0) 编辑