Results 1 to 2 of 2
  1. #1
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176

    I want to group by only 1 field?

    I have 5 fields, I want to group by one of them (ProjectCode) and sum another (ContractAmount), leave everything else the same.
    I tried to group by 4 and sum the last one but I went from having 1030 rows to 606 :
    Click image for larger version. 

Name:	Capture.PNG 
Views:	9 
Size:	26.1 KB 
ID:	13028
    How it works is that each project can have more than one trade code, I want to get the sum of all the "ContractAmount"s for one project



    When I went into SQL I tried to just delete that GROUP BY fields that I didn't want grouped but it turned them into expressions and I got errors because they did not have an expression entered.

    I can figure this out using 2 queries but I am sure that there has to be a way to just use one,
    Ideas?

    Thanks!

    Code:
    SELECT FOCOSumTotal.ProjectCode, BidQuestoinCount.CountOfQuestionId AS Questions, FOCOSumTotal.Sum AS [Sum Of Change Amount], FOCOSumTotal.ProjectAwardDate, Sum(dbo_Contract.ContractAmount) AS SumOfContractAmount
    FROM (FOCOSumTotal INNER JOIN BidQuestoinCount ON FOCOSumTotal.ProjectCode = BidQuestoinCount.ProjectCode) INNER JOIN dbo_Contract ON BidQuestoinCount.ProjectCode = dbo_Contract.ProjectCode
    GROUP BY FOCOSumTotal.ProjectCode, BidQuestoinCount.CountOfQuestionId, FOCOSumTotal.Sum, FOCOSumTotal.ProjectAwardDate
    HAVING (((FOCOSumTotal.Sum) Is Not Null And (FOCOSumTotal.Sum)<>0))
    ORDER BY BidQuestoinCount.CountOfQuestionId, FOCOSumTotal.Sum;

  2. #2
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    I did it again, found what I was messing up, the initial 1030 was wrong

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Group on a totals field
    By dharsh in forum Access
    Replies: 14
    Last Post: 07-11-2013, 10:43 AM
  2. Replies: 1
    Last Post: 04-16-2013, 09:51 PM
  3. Group by one field, sort by another
    By tylerg11 in forum Reports
    Replies: 4
    Last Post: 03-05-2013, 01:17 PM
  4. Group text field
    By DanielY8 in forum Queries
    Replies: 4
    Last Post: 10-28-2011, 12:38 AM
  5. Group by one field, but not another!?
    By Demonweare in forum Access
    Replies: 2
    Last Post: 06-23-2010, 05:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums