0

I have tried this code in SQL it is working fine but in hive it is not working

select((select sum(price) from apart where construction_year=2020) - (select sum(price) from apart where construction_year=1990)) as difference_between_1990_and_2020;
  • Does this answer your question? [Minus query in HIVE](https://stackoverflow.com/questions/30760371/minus-query-in-hive) – Gregor May 09 '22 at 11:19

1 Answers1

0

you need to convert them to subquery

select p20-p19 as difference_between_1990_and_2020
from 
(select((select sum(price) p20 from apart where construction_year=2020) rs20
join (select sum(price) p19 from apart where construction_year=1990) rs19 on 1=1
Koushik Roy
  • 6,868
  • 2
  • 12
  • 33