0

I am trying to write a join using subquery/ temporary table in hive but it doesn't seem to be working:

create temporary table  q as select server, max(time) as time from ghs group by header.server;

create temporary table new_joined as 
select q.server,ghs.proccount, ghs.net from ghs right outer join 
q on ghs.server = q.server;

the first query gives me around 23k rows, I want the joined table also to give me only 23k rows but I see that this is joining with each row in ghs. ghs table is like superset having 1.2 million records.

Can someone help me understand what I am doing wrong?

0
0

I just had to add time also to my join condition on clause and I got the desired reult.

1
  • 1
    It would be good if you added the correct query to your answer. Thanks!
    – Hannah Vernon
    Dec 2 '20 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.