select top 30 from tablename where studentid not in(select top 30*10 studentid from tablename) --30*10必须写成300,这需要使用动态语句来执行
或者: int total = 311; int currentRoom = 11; int numberPerRoom = 30; if total>=currentRoom *numberPerRoom; return numberPerRoom; else if(total <= (currentRoom-1)*numberPerRoom) return 0; else return total-(currentRoom-1)*numberPerRoom;
int total = 311; int i = 1; for (; i < total / 30; i++) { Console.WriteLine("第{0}房是30人", i); } if (total % 30 != 0) { Console.WriteLine("第{0}房是{1}人", i, total % 30); }
int total = 311;
int currentRoom = 11;
int numberPerRoom = 30;
if total>=currentRoom *numberPerRoom;
return numberPerRoom;
else if(total <= (currentRoom-1)*numberPerRoom)
return 0;
else
return total-(currentRoom-1)*numberPerRoom;
int i = 1;
for (; i < total / 30; i++)
{
Console.WriteLine("第{0}房是30人", i);
}
if (total % 30 != 0)
{
Console.WriteLine("第{0}房是{1}人", i, total % 30);
}