Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Akshaya Pargunan
Starting Member
10 Posts |
Posted - 2011-10-11 : 10:26:25
|
i have a table like belowDateofRequest hours---------------- ------10/10/2011 311/10/2011 612/10/2011 713/10/2011 214/10/2011 115/10/2011 9I want one more column in this with below condtionDateofRequest hours Total Hours---------------- ------ -------------10/10/2011 3 311/10/2011 6 3+612/10/2011 7 3+6+713/10/2011 2 3+6+7+214/10/2011 1 3+6+7+2+115/10/2011 9 3+6+7+2+1+7Formula for Totalhours = sum(hours) where DateofRequest < all DateofRequest date less then current row |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-10-11 : 10:27:56
|
this is running totalselect DateofRequest, hours, [Total Hours] = (select sum(hours) from tbl x where x.DateofRequest <= t.DateofRequest)from tbl t KH[spoiler]Time is always against us[/spoiler] |
|
|
Akshaya Pargunan
Starting Member
10 Posts |
Posted - 2011-10-12 : 04:17:54
|
Thank u very muchit helped me |
|
|
adityasingh.n.solanki
Starting Member
1 Post |
Posted - 2011-10-12 : 04:43:57
|
I want the complete execution of the query of finding the 2nd most highest salary among the employees?Help me please.Aditya |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-10-12 : 07:12:30
|
quote: Originally posted by adityasingh.n.solanki I want the complete execution of the query of finding the 2nd most highest salary among the employees?Help me please.Aditya
sounds like homework to me KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|