Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6118177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:24:22+00:00 2026-05-23T15:24:22+00:00

I can successfully compute the 200 day moving average for one ticker using a

  • 0

I can successfully compute the 200 day moving average for one ticker using a SQL query, I’m trying now to create a VIEW. I am stuck the following query seems logical but there is a SQL error
“#1054 – Unknown column ‘equity.TickerID’ in ‘where clause'”

SELECT  AVG(Close) AS MA200 FROM equity
INNER JOIN
(
    SELECT Close 
    FROM equity_pricehistory  
    WHERE TickerID = equity.TickerID 
    ORDER BY Timestamp 
    DESC LIMIT 0,200
) as Y
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:24:23+00:00Added an answer on May 23, 2026 at 3:24 pm

    Got it. This will do the trick.

    SELECT equity.id, AVG( equity_pricehistory.close ) AS MA200
    FROM equity
    INNER JOIN equity_pricehistory ON equity_pricehistory.TickerID = equity.id
    GROUP BY equity_pricehistory.TickerID
    ORDER BY Timestamp DESC
    LIMIT 0 , 200
    

    One thing I would point out is that you could totally ignore the whole equity table if you already know all the TickerIDs you want are in equity_pricehistory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an iphone 3g and can successfully send text messages using the PHP
Title says what i'm trying to do. I can successfully generate an assembly if
I have an HBITMAP containing alpha channel data. I can successfully render this using
I'm trying to convert CLLocation latitude / longitude to a string. I can successfully
I have SQL Server 2008 to which I can connect using domain user credentials.
I'm having trouble seeing tables from one particular SQL Server 2008 database while trying
I can successfully connect to MySQL from a DOS prompt, but when I try
I can successfully include main jquery files in /Scripts, but if my custom test.js
Can anyone explain how I can successfully get my processes communicating? I find the
the title already tells the question: you can successfully call the Print-Method on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.