问一个SQL语句的写法
有一个表TTT
ID Money DT
10001 1000 2007-01
10002 999 2007-01
... ... .....
11003 5 2007-01
10001 1000 2007-02
... ... ...
11000 2 2007-02
ID不重复 Money是钱数 DT是时间年和月
Money是排好续的
怎么显示按照时间只显示前5个
ID Money DT
10001 1000 2007-01
10002 999 2007-01
10003 998 2007-01
10004 997 2007-01
10005 996 2007-01
10001 1000 2007-02
10002 999 2007-02
10003 998 2007-02
10004 997 2007-02
10005 996 2007-02
10001 1000 2007-03
10002 999 2007-03
10003 998 2007-03
10004 997 2007-03
10005 996 2007-03
------解决方案--------------------select * from TTT a where ID in (select top 5 ID from TTT where DT = a.DT)
------解