So I am trying to extract the date,strike price, and ask price from a data set given a particular date for each month in 2015, where additional unique restriction apply to the strike price and we want the largest strike price with its corresponding ask price. For instance, on date A, we want max(strike price <= x1), and max(strike price<=x2) on date B. So I am thinking to write 10 SELECT statements to implement this, but this seems to be inefficient. Heres a sample query I wrote:
SELECT currentdate,max(strike),ask
FROM opt
WHERE currentdate between '2015-01-16' and '2015-01-16'
AND T='P'
AND strike <=191.55;
And when I run this in impala, I have the error:
Starting Impala Shell without Kerberos authentication ERROR: AnalysisException: select list expression not produced by aggregation output (missing from GROUP BY clause?): currentdate
I apologize for the bad formatting, not very familiar with Stackover.
impala. You would get the same kind of syntax error with any SQL database. Learn SQL, that's a good investment for your career... - Samson Scharfrichterstrikeif Impala supports thecasesyntax (it's been a long time since I last used that particular tool...) > try 10 different columns such asmax(case when strike <=191.55 then strike else null end)-- just one full scan. - Samson Scharfrichter