Results 1 to 3 of 3
  1. #1
    UTLee is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    73

    Help with basic query

    I have the following query:
    Code:
    SELECT qryData.client, qryData.USorINTL, Sum(qryData.CatAmount) AS SumOfCatAmountFROM qryData
    GROUP BY qryData.client, qryData.USorINTL
    HAVING (((qryData.USorINTL) Like "US" Or (qryData.USorINTL) Like "Int*"));
    It shows, for each client, the dollar amount of their assets that have been categorized as US equities or International equities. I need another column that sums the two CatAmount values shown for each client, to get the sum total of their US and International equities, while still showing the two separate categories in the query. Any help is much appreciated.

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,931
    try

    Code:
    SELECT qryData.client, Sum(iif(USorINTL = "US",CatAmount,0)) AS USCatAmount, Sum(iif(USorINTL Like "Int*",CatAmount,0)) AS IntlCatAmount,Sum(CatAmount) AS TotalCatAmount
    FROM qryData
    GROUP BY qryData.client
    HAVING (((qryData.USorINTL) Like "US" Or (qryData.USorINTL) Like "Int*"));
    Last edited by CJ_London; 11-25-2015 at 09:53 AM. Reason: took out field not required

  3. #3
    UTLee is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    73
    Had to modify it a bit but got it to work. Thanks for your help!

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

Similar Threads

  1. Basic Query Help
    By UTLee in forum Queries
    Replies: 3
    Last Post: 09-29-2015, 09:51 AM
  2. Basic query to vba translations
    By Lewis in forum Programming
    Replies: 2
    Last Post: 05-08-2015, 03:32 AM
  3. Query Help VERY BASIC
    By nparrillo in forum Queries
    Replies: 5
    Last Post: 04-06-2011, 11:15 AM
  4. Query in visual basic
    By Lucas83 in forum Programming
    Replies: 1
    Last Post: 06-10-2010, 11:00 AM
  5. basic query codes
    By joms222 in forum Queries
    Replies: 1
    Last Post: 03-20-2009, 11:31 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