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
Got it. This will do the trick.
One thing I would point out is that you could totally ignore the whole
equitytable if you already know all the TickerIDs you want are inequity_pricehistory.