表记录序数的添加问题
有表T1:
a                b                  c                  d                     
1001             blue               20080303          7:55
1001             blue               20080303          12:06
1001             blue               20080303          13:25
1001             blue               20080303          17:36
1001             blue               20080304          7:50
1001             blue               20080304          12:10
1001             blue               20080304          13:22
1001             blue               20080304          17:35
如何实现表T2:
a                b                  c                  d             e           
1001             blue               20080303          7:55           1
1001             blue               20080303          12:06          2
1001             blue               20080303          13:25          3
1001             blue               20080303          17:36          4
1001             blue               20080304          7:50           1
1001             blue               20080304          12:10          2
1001             blue               20080304          13:22          3
1001             blue               20080304          17:35          4
------解决方案--------------------select *,=(select count(*) from tb where a.c=c and d<a.d)+1
from tb a
------解决方案--------------------select *,e =(select count(*) from tb where a.c=c and d <a.d)+1  
from tb a
------解决方案--------------------SQL code
select * , e = (select count(1) from t1 where a = t.a and b = t.b and c = t.c and d < t.d) + 1 from t1