Results 1 to 3 of 3
  1. #1
    frind is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2013
    Posts
    2

    Question Including aggregate functions in a query

    I have the following simple query to estimate the time a student has left on a waitlist:
    Code:
    SELECT StudentName, ((Date()-ApplyDate)/(origwaitlistnum-waitlistnum)) AS DaysPerSlot, Waitlistnum*avg(DaysPerSlot) as TimeTillAccepted
    FROM [Prospective Student];
    DaysPerSlot is how many days it takes that student to move up one spot in the wait list. Waitlistnum is, of course, their current position on the list.

    When I run this query, however, I get the error: Your query does not contain StudentName as part of an aggregate function.



    I do not understand why this keeps throwing errors--is there a way to multiply the WaitlistNum by the average of DaysPerSlot? I can't think of any way to do it without an aggregate function involved somehow.

    Thanks for the help!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Have to do a subquery that does the Avg aggregate calc or use DAvg domain aggregate function.

    Or build a report and do the aggregate calc in group/report header/footer sections.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    frind is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2013
    Posts
    2
    Thank you, davg works perfectly

    Quote Originally Posted by June7 View Post
    Have to do a subquery that does the Avg aggregate calc or use DAvg domain aggregate function.

    Or build a report and do the aggregate calc in group/report header/footer sections.

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

Similar Threads

  1. Finding Max of two nested aggregate functions in SQL
    By SummertimeClothes in forum Queries
    Replies: 1
    Last Post: 10-30-2012, 12:00 PM
  2. aggregate functions
    By gsrikanth in forum Access
    Replies: 3
    Last Post: 07-10-2012, 03:56 PM
  3. Replies: 5
    Last Post: 02-23-2012, 05:22 PM
  4. Replies: 1
    Last Post: 12-11-2008, 01:28 PM
  5. Replies: 0
    Last Post: 06-07-2007, 02:33 PM

Tags for this Thread

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