错误 SQL TOP子句中的行数必须是整数
生活随笔
收集整理的這篇文章主要介紹了
错误 SQL TOP子句中的行数必须是整数
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
sql = "select * from TABLE where id=‘“+id+”’";
sql = "select top "+PageSize.ToInt32() +" * from TABLE where id not in(select top " +
Convert.ToInt32((pageno-1)*PageSize) +" id from TABLE)";
示例:
Select top 10 *
from A
where a not in(select top 10 a from A) and b not in(select top 10 b from A)
not in 效率低,用left join 改寫為:
Select top 10 * from A x
left join (select top 10 a from A) y on x.a = y.a
left join (select top 10 b from A) z on x.b = z.b
where y.a is null and z.b is null
sql = "select top "+PageSize.ToInt32() +" * from TABLE where id not in(select top " +
Convert.ToInt32((pageno-1)*PageSize) +" id from TABLE)";
示例:
Select top 10 *
from A
where a not in(select top 10 a from A) and b not in(select top 10 b from A)
not in 效率低,用left join 改寫為:
Select top 10 * from A x
left join (select top 10 a from A) y on x.a = y.a
left join (select top 10 b from A) z on x.b = z.b
where y.a is null and z.b is null
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/lushuicongsheng/archive/2010/12/06/1897609.html
總結(jié)
以上是生活随笔為你收集整理的错误 SQL TOP子句中的行数必须是整数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: WPF 文本呈现(2)
- 下一篇: windows7下取消PDF格式文件图标