Usually, when you post a request like this, you should provide something a little more concrete (the CREATE TABLE statement for that table, with
Since you didn't, I'll posit something that sounds like what you're using, and take a stab at your problem.
TABLE Prices (
,PRIMARY KEY (stock, asof)
SELECT stock, AVG((closing-opening)/opening) as ratio
GROUP BY stock
ORDER BY ratio DESC LIMIT 10; -- top 10 best-performing stocks.
- [PERFORM] Query performance Bill
- Re: [PERFORM] Query performance Richard Huxton
- [PERFORM] Query Performance Mischa Sandberg
- [PERFORM] Query Performance Danilo Mota
- Re: [PERFORM] Query Performance Brad Bulger