首页 > 其他 > 详细

黑马视频—循环

时间:2015-11-16 22:33:55      阅读:254      评论:0      收藏:0      [点我收藏+]
  1. --不及格人数超过总人数一般,则给每人加2分,直到不及格人数小于一半为止
  2. --1.计算总人数
  3. declare @count=(select count(*) from TblScore)
  4. --2.英语不及格人数
  5. declare @loser=(select count(*) from TblScoe where tenglish<60)
  6. print @count/2
  7. while @loser>@count/2
  8. begin
  9. update TblScore set tenglish=tenglish+2 where tengish<60
  10. --3.每次提分完毕后重新计算当前不及格的人数
  11. @loser=(select count(*) from TblScoe where tenglish<60)
  12. end
  13. print ceiling(11/2.0)
  14. print floor(11/2.0)





黑马视频—循环

原文:http://www.cnblogs.com/wupd2014/p/4970120.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!