Reputation: 1259
I want to execute this sql query on a hive table:
select * from sampleDB.sampleTable
where sampleDate>=(select convert(DATE, dateadd(MONTH,-6,getdate())));
But I am getting this error: Error while compiling statement: FAILED: parse exception line 1:64 cannot recognize input near 'select' 'convert' '(' in expression specification (state=42000,code=40000)
Can someone help me understand how this can be achieved? Basically I want to filter on date say 6 months from current date.
Thanks!
Upvotes: 0
Views: 479
Reputation: 4957
Hive do not supports only >= in sub query it support only below type of sub query
Scalar subqueries
IN subqueries
EXISTS subqueries
you can achieve the same with daenter link description hereteformate
select * from sampleDB.sampleTable
where sampleDate>= date_format(current_date - interval '7' day,'%Y-%m-%d') ;
Upvotes: 1