+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    04-09-2009
    Location
    New Carrollton, MD
    MS-Off Ver
    Excel 2003
    Posts
    4

    Question Aggregate data in query

    Hello,

    I have a select query that extract data from a table - example attached. What I need to do is:

    - if I pick multiple days (as in example), aggregate the time frames into one row; example all 7:00 am should show once and the rest of the data fields summed as well.

    - In the example, I should see something like that:

    10025 31-Oct-09 7:00:00 AM 1 0

    A new calculated date index can be shown there as well to represent the combined days.

    I hope to have explained this issue the best I can. If more is needed, please let me know.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Moderator ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2003 & 2010
    Posts
    1,797

    Re: Aggregate data in query

    Hi Ibernadel,

    Do you mean something like this:

    Code:
    SELECT AppID, TimeStamp, Time, Sum(CallsOffered) AS SumOfCallsOffered, Sum(ASA) AS SumOfASA
    FROM tblCalls
    GROUP BY AppID, TimeStamp, Time;
    or this?

    Code:
    SELECT Time, Sum(CallsOffered) AS SumOfCallsOffered, Sum(ASA) AS SumOfASA
    FROM tblCalls
    GROUP BY Time;
    Your example doesn't show the same kind of sum these queries will extract.

    Cheers,
    Docendo discimus.

    Please consider:
    • Thanking those who helped you. Click the reputation icon in the contributor's post and add Reputation.
    • Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    04-09-2009
    Location
    New Carrollton, MD
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Aggregate data in query

    Hi ConneXionLost,

    Thank you for your response. I would want the query to sum the SAS and CallsOffered and group them by Time; which I sense the second example will do.

    I will try that and report. In the meantime, if you have any other suggestion, please let me know.

    Thank You!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0