欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

sql 取兩值之間的數(shù)據(jù)方法(例:100-200之間的數(shù)據(jù))

 更新時(shí)間:2010年05月19日 00:01:31   作者:  
這里只列舉3種我測(cè)試的方法,還有別的方案就由高手補(bǔ)上了,3種方案的效率也不競(jìng)相同,我一直認(rèn)為not in效率不好,但在這里使用not in速度最快,請(qǐng)高手補(bǔ)充說(shuō)明,謝謝
題:取表table中100條-200條之間數(shù)據(jù)

方法1:臨時(shí)表
復(fù)制代碼 代碼如下:

select top 200 * into #aa from table order by time-- 將top m筆插入 臨時(shí)表
set rowcount 100
select * from #aa order by time desc

--drop table #aa --刪除臨時(shí)表



方法2:
復(fù)制代碼 代碼如下:

select top 100 * from
(select top 200 * from table order by time asc) a
order by time desc



方法3:not in
復(fù)制代碼 代碼如下:

select top 100 * from v_company where (
id not in
(select top 100 id from v_company order by id asc)
) order by id asc



這里只列舉3種我測(cè)試的方法,還有別的方案就由高手補(bǔ)上了,3種方案的效率也不競(jìng)相同,我一直認(rèn)為not in效率不好,但在這里使用not in速度最快,請(qǐng)高手補(bǔ)充說(shuō)明,謝謝

相關(guān)文章

最新評(píng)論