Hive DML with subquerries


#1

I can able to run the following HIVE query successfully:

select stockticker,tradedate,openprice,highprice,lowprice,closeprice,volume from stocks_eod_ext
where stockticker=‘AIG’ and highprice=2075.0
union
select stockticker,tradedate,openprice,highprice,lowprice,closeprice,volume from stocks_eod_ext
where stockticker=‘AIG’ and lowprice=6.6;

Here instead of giving hard coded values, I want to get value through sub-query as below:

select stockticker,tradedate,openprice,highprice,lowprice,closeprice,volume from stocks_eod_ext
where stockticker=‘AIG’ and highprice=(select max(highprice) from stocks_eod_ext where stockticker=‘AIG’);

I did verified by running sub-query individually and it’s running fine too.

It is failing and giving the following error message:

Please advise, how execute the sub-quries.


#2