共 6 篇文章 |
|
1. select top @pagesize * from table1 where id not in (select top @pagesize*(@page-1) id from table1 order by id) order by id.2. select * from (select top @pagesize * from (select top @pagesize*@page * from table1 order by id) a order by id desc) b order by id.做两个table,各有1万条记录,一个table的id有index,一个没有... 阅975 转1 评0 公众公开 09-05-08 23:00 |
= '''' SET @strSql = ''SELECT TOP ''+STR(@pageSize)+'' ''+@showColumn+'' FROM ''+@tabName+ '' WHERE ''+@strCondition+@strOrderType ELSE SET @strSql = ''SELECT TOP ''+STR(@pageSize)+'' ... 阅1810 转17 评0 公众公开 09-05-08 22:54 |
JDBC连SQL SERVER数据库常见问题Can''t start a cloned connection while.错误:java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can''t start a cloned connection while in manual.在我使用 过程中发现了java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can''t start a clo... 阅3596 转13 评0 公众公开 09-05-08 22:04 |
答案一、select year, (select amount from aaa m where month=1 and m.year=aaa.year) as m1,(select amount from aaa m where month=2 and m.year=aaa.year) as m2,(select amount from aaa m where month=3 and m.year=aaa.year) as m3,(select amount from aaa m where month=4 and m.year=aaa.year) as m4from aaa grou... 阅2132 转68 评0 公众公开 09-04-13 23:06 |
SQL面试题[经典收录]请用SQL语句实现将上表中的数据合并,合并后的数据为: p_ID s1_id s2_id s3_id 1 10 12 0 2 8 0 0 3 11 0 8 其中:s1_id为仓库1的库存量,s2_id为仓库2的库存量,s3_id为仓库3的库存量。select p_id ,sum(case when s_id=1 then p_num else 0 end) as s1_id,sum(case when s_id=2 then p_num else 0 end) as s2_id,sum(cas... 阅17294 转385 评0 公众公开 09-04-13 23:04 |
Mysql日期和时间函数不求人(转载)原文来自:http://hi.baidu.com/onino%5Finfo/blog 对于每个类型拥有的值范围以及并且指定日期何时间值的有效格式的描述见7.3.6 日期和时间类型。mysql> select DATE_ADD(''1998-01-30'', Interval 1 month);mysql> select NOW();FROM_UNIXTIME(unix_timestamp) 以''YYYY-MM-DD ... 阅137 转2 评0 公众公开 09-04-11 13:56 |