Use join instead :

select as_of_dt as as_of_dt, max_feed_key as max_feed_key, min_feed_key as 
min_feed_key
from table feed_key_temp join ( select max(feed_key) mfk from summ_table ) st
where max_fed_key > mfk
group by as_of_dt ;

This join is done without an "ON" clause. This way, all the rows in 
"feed_key_temp" table will be joined with a single row from st containing the 
max(feed_key) value


From: yogesh dhari [mailto:yogeshh...@gmail.com]
Sent: Wednesday, January 22, 2014 7:42 PM
To: user@hive.apache.org
Subject: HIVE SUB QUERY:: How to implement this case


Hello all,

I have a case statement where I need to work like this logic.

select as_of_dt as as_of_dt, max_feed_key as max_feed_key, min_feed_key as 
min_feed_key from table feed_key_temp where max_fed_key > ( select 
max(feed_key) from summ_table ) group by as_of_dt ;



Here, max_feed_key and min_feed_key are the fields in table  feed_key_temp.



As Hive does not provide (0.9 version)  sub query in where clause, Pls suggest 
the work around it, and how to implement it



Thanks & Regards

Yogesh Kumar



************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer 
viruses.
************************************************************************************

Reply via email to