日期:2014-05-18 浏览次数:20476 次
select top " + NUMCount + " * from tb_Student where ID not in ( select top " + number + " ID from tb_Student where fengcai=" + num + " order by ID desc )and fengcai=" + num + " order by ID desc
string city = "重庆"; int NUMCount = 10; int number = 100; int num = 5; string s = "select top " + NUMCount + " * from tb_Student where ID not in ( select top " + number + " ID from tb_Student where fengcai=" + num + " order by ID desc ) and fengcai=" + num + " and city='" + city + "' order by ID desc";
------解决方案--------------------
select top "+NUMCount+" from tb_Student where ID not in(select top "+number+" ID from tb_Student where fengcai="+num+" and city='"+重庆+"') and fengcai="+num+" and city='"+重庆+"' order by ID desc