怎样用SQL语句查询以20%来分段查询数据,如查询该表中数据数量20%到40%的数据怎查来。

[复制链接]
查看11 | 回复3 | 2013-7-17 11:00:18 | 显示全部楼层 |阅读模式
我赞成的是:select * from (select top (select convert(int,count(selfid)*0.4) from s_menu) * from s_menu ) a where selfid not in(select top (select convert(int,count(selfid)*0.2) from s_menu) selfid from s_menu) 不赞成:select * from t_qkxx where lsh in (select top 40 percent lsh from t_qkxx where lsh not in (select top 20 percent ls...
回复

使用道具 举报

千问 | 2013-7-17 11:00:18 | 显示全部楼层
select top (select convert(int,count(id)*0.4*0.2) from s_menu) * from s_menu可以把count(id)换成100试验一下...
回复

使用道具 举报

千问 | 2013-7-17 11:00:18 | 显示全部楼层
查询在40%的数据20%不存在的...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行