![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi all. I have this data: id GroupId DDate Value 1 1 7/31/2008 5 2 1 7/31/2008 6 3 1 7/31/2008 2 4 2 7/31/2008 1 5 2 7/31/2008 2 6 2 7/31/2008 1 From this raw dataI want to show the data like this" GroupId DDate TotalValue 1 7/31/2008 13 2 7/31/2008 4 current Query that I Use is Select D.GroupId,(Select Top 1 DDate From MyTable Where GroupId=D.GroupId)As DDate, Sum(D.Value) As TotalValue From MyTable D Group By D.GroupId But I want to remove the subquery, so my query will run faster. Could it be done? Thanks in Advanced |
#3
| |||
| |||
|
|
Hi all. I have this data: id GroupId DDate Value 1 1 7/31/2008 5 2 1 7/31/2008 6 3 1 7/31/2008 2 4 2 7/31/2008 1 5 2 7/31/2008 2 6 2 7/31/2008 1 From this raw dataI want to show the data like this" GroupId DDate TotalValue 1 7/31/2008 13 2 7/31/2008 4 current Query that I Use is Select D.GroupId,(Select Top 1 DDate From MyTable Where GroupId=D.GroupId)As DDate, Sum(D.Value) As TotalValue From MyTable D Group By D.GroupId But I want to remove the subquery, so my query will run faster. Could it be done? Thanks in Advanced |
#4
| |||
| |||
|
|
Hi all. I have this data: id GroupId DDate Value 1 1 7/31/2008 5 2 1 7/31/2008 6 3 1 7/31/2008 2 4 2 7/31/2008 1 5 2 7/31/2008 2 6 2 7/31/2008 1 From this raw dataI want to show the data like this" GroupId DDate TotalValue 1 7/31/2008 13 2 7/31/2008 4 current Query that I Use is Select D.GroupId,(Select Top 1 DDate From MyTable Where GroupId=D.GroupId)As DDate, Sum(D.Value) As TotalValue From MyTable D Group By D.GroupId But I want to remove the subquery, so my query will run faster. Could it be done? Thanks in Advanced |
#5
| |||
| |||
|
|
Hi all. I have this data: id GroupId DDate Value 1 1 7/31/2008 5 2 1 7/31/2008 6 3 1 7/31/2008 2 4 2 7/31/2008 1 5 2 7/31/2008 2 6 2 7/31/2008 1 From this raw dataI want to show the data like this" GroupId DDate TotalValue 1 7/31/2008 13 2 7/31/2008 4 current Query that I Use is Select D.GroupId,(Select Top 1 DDate From MyTable Where GroupId=D.GroupId)As DDate, Sum(D.Value) As TotalValue From MyTable D Group By D.GroupId But I want to remove the subquery, so my query will run faster. Could it be done? Thanks in Advanced |
#6
| |||
| |||
|
|
Hi all. I have this data: id GroupId DDate Value 1 1 7/31/2008 5 2 1 7/31/2008 6 3 1 7/31/2008 2 4 2 7/31/2008 1 5 2 7/31/2008 2 6 2 7/31/2008 1 From this raw dataI want to show the data like this" GroupId DDate TotalValue 1 7/31/2008 13 2 7/31/2008 4 current Query that I Use is Select D.GroupId,(Select Top 1 DDate From MyTable Where GroupId=D.GroupId)As DDate, Sum(D.Value) As TotalValue From MyTable D Group By D.GroupId But I want to remove the subquery, so my query will run faster. Could it be done? Thanks in Advanced |
#7
| |||
| |||
|
|
Hi all. I have this data: id GroupId DDate Value 1 1 7/31/2008 5 2 1 7/31/2008 6 3 1 7/31/2008 2 4 2 7/31/2008 1 5 2 7/31/2008 2 6 2 7/31/2008 1 From this raw dataI want to show the data like this" GroupId DDate TotalValue 1 7/31/2008 13 2 7/31/2008 4 current Query that I Use is Select D.GroupId,(Select Top 1 DDate From MyTable Where GroupId=D.GroupId)As DDate, Sum(D.Value) As TotalValue From MyTable D Group By D.GroupId But I want to remove the subquery, so my query will run faster. Could it be done? Thanks in Advanced |
#8
| |||
| |||
|
|
Hi all. I have this data: id GroupId DDate Value 1 1 7/31/2008 5 2 1 7/31/2008 6 3 1 7/31/2008 2 4 2 7/31/2008 1 5 2 7/31/2008 2 6 2 7/31/2008 1 From this raw dataI want to show the data like this" GroupId DDate TotalValue 1 7/31/2008 13 2 7/31/2008 4 current Query that I Use is Select D.GroupId,(Select Top 1 DDate From MyTable Where GroupId=D.GroupId)As DDate, Sum(D.Value) As TotalValue From MyTable D Group By D.GroupId But I want to remove the subquery, so my query will run faster. Could it be done? Thanks in Advanced |
#9
| |||
| |||
|
|
Hi all. I have this data: id GroupId DDate Value 1 1 7/31/2008 5 2 1 7/31/2008 6 3 1 7/31/2008 2 4 2 7/31/2008 1 5 2 7/31/2008 2 6 2 7/31/2008 1 From this raw dataI want to show the data like this" GroupId DDate TotalValue 1 7/31/2008 13 2 7/31/2008 4 current Query that I Use is Select D.GroupId,(Select Top 1 DDate From MyTable Where GroupId=D.GroupId)As DDate, Sum(D.Value) As TotalValue From MyTable D Group By D.GroupId But I want to remove the subquery, so my query will run faster. Could it be done? Thanks in Advanced |
#10
| |||
| |||
|
|
Hi all. I have this data: id GroupId DDate Value 1 1 7/31/2008 5 2 1 7/31/2008 6 3 1 7/31/2008 2 4 2 7/31/2008 1 5 2 7/31/2008 2 6 2 7/31/2008 1 From this raw dataI want to show the data like this" GroupId DDate TotalValue 1 7/31/2008 13 2 7/31/2008 4 current Query that I Use is Select D.GroupId,(Select Top 1 DDate From MyTable Where GroupId=D.GroupId)As DDate, Sum(D.Value) As TotalValue From MyTable D Group By D.GroupId But I want to remove the subquery, so my query will run faster. Could it be done? Thanks in Advanced |
![]() |
| Thread Tools | |
| Display Modes | |
| |