My Blog is my notepad, I want to mark my work anytime, also i can share my harvest with everyone....

Teracy 's space--->

I love BS Develop ,So i am busying as a bee.Do more,Know more,you will get more.....

博客园 首页 新随笔 联系 订阅 管理
今天上班礼拜一,没有什么事做,前一段时间比较忙,好久没有来写点东西了,回顾前几天的工作,让我记忆犹新的是一个简单而又花了我几个小时的sql现在拿出来给大家看看我有多菜咯,呵呵。。。
table TT
id point
1 87
2 23
2 43
3 3
2 56
1 54

现在的需求是将表中point>100的id显示出来,我真的弄晕了一下:
下面一个SQL Script大家看看是不是可以优化咯。
select A.id ,sum(Point) as p from TT A where (select sum(point) pp from TT B where B.id=A.id)>100
group by id order by id Desc 
posted on 2007-06-18 10:12  Teracy  阅读(294)  评论(4编辑  收藏  举报
One Two Three 向“前”走............
frontpage tracking
Sony Style Coupons