How to show field that not being group?



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
.



Relevant Pages

  • Re: delete row query doesnt remove all row when run from access (ms sql)
    ... SET NOCOUNT ON ... DECLARE @dDate AS SMALLDATETIME ... When I run the query from Query Analyzer it does work perfectly. ...
    (microsoft.public.access.queries)
  • Open store procedure from VBA
    ... I created a sp procedure with multi select statement. ... DECLARE @STR INT ... SELECT dDate, Area, Source, FctOil, FctWater, FctGross, FctGas ... If in the query analyzer I can open the right statement what is wrong? ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Top10 from another view
    ... This query is the best thing that I could make ... In the case of a SP, you can also use a cursor ... without using a primary key but it's much more complicated. ... SELECT dDate, Well ...
    (microsoft.public.access.adp.sqlserver)
  • How to show field that not being group
    ... GroupId=D.GroupId)As DDate, SumAs TotalValue From MyTable D ... But I want to remove the subquery, so my query will run faster. ...
    (comp.databases.ms-sqlserver)
  • SQL string problem - pleaze hellp!
    ... The following actually creates a query but with nothing in it, ... where I am sure there are patients with "DDate" in the moth specified by my ... Prev by Date: ...
    (microsoft.public.access.formscoding)