日期:2014-05-17  浏览次数:20709 次

关于asp中如何选取数据库中相同记录的前两条
表中有检查人jcrxm,检查时段jcsd,检查日期jcrq等等,如何按人名进行检查次数的统计,然后选取前两条记录显示出来
用select count(*) from JCXS_INFO where jcrq between to_date() and to_date() and jcsd like "%"
大概就是这个语句,请教高手指点

------解决方案--------------------
SQL code
select * from (select jcrxm, count(jcrxm) as cnt from JCXS_INFO where (jcrq between ? and ?) and jcsd like ? group by jcrxm order by cnt desc) t where t.rownum <= 2

------解决方案--------------------
探讨
还是不行啊,提示错误无效的用户,表,列或列规格
语句这样写的set rsk=cn.execute(( "select * form (select jcsd,jcrq,jcrxm,count(jcrxm) as cnt from jcxs_info where jcrq between? and ? and jcsd like ……