Results 1 to 3 of 3
  1. #1
    Bob M is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2013
    Posts
    43

    query to calculate a 20 moving average

    Hi



    I have the following query:-

    SELECT time AS "Datetime",
    cprice AS "Close_EURUSD",
    AVG(cprice) OVER (ORDER BY day ROWS BETWEEN 19 PRECEDING AND 0 FOLLOWING)::FLOAT AS "20-Minute Moving Average"
    FROM Z200418
    ORDER BY 1 DESC

    I get a syntax error (missing operator in expression - the 3rd line commencing AVG(cprice) with the word OVER highlighted

    where am I going wrong ?
    Bob M

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    access sql does not use OVER.
    use the query designer, it wont make errors.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

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

Similar Threads

  1. Replies: 6
    Last Post: 06-05-2015, 03:08 AM
  2. Moving average calculation
    By Secue in forum Access
    Replies: 1
    Last Post: 08-13-2013, 01:28 PM
  3. Calculate the Average
    By Jerseynjphillypa in forum Queries
    Replies: 1
    Last Post: 06-18-2012, 03:26 PM
  4. Calculate average in a query
    By srbooth in forum Queries
    Replies: 1
    Last Post: 02-20-2010, 09:41 AM
  5. Select query for Exponential Moving Average.
    By krishna79 in forum Queries
    Replies: 0
    Last Post: 01-22-2009, 05:52 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