0

I have a situation like,

  • if I have multiple records exists on column X in the table TAB then I need to run "Query #1"

  • if I have only one record exists on column X in the table TAB then I need to run "Query #2"

The selected columns are same but the condition is different.

I tried with case clause but it did not worked.

Is there any way to achieve in Hive ?

Can we use ”Query #” in case clause? If yes please suggest an example.

user4157124
  • 2,809
  • 13
  • 27
  • 42
Sekhar
  • 627
  • 4
  • 14
  • 34
  • 3
    Welcome to stackoverflow. Please include what you have tried so far in your question. See [How do I ask a good question](https://stackoverflow.com/help/how-to-ask). – LeoE Nov 22 '19 at 14:06
  • Possible duplicate of [What's the best way to write if/else if/else if/else in HIVE?](https://stackoverflow.com/questions/32472801/whats-the-best-way-to-write-if-else-if-else-if-else-in-hive) – U880D Nov 22 '19 at 14:24
  • I am not sure case clause will work. can we use any queries in case when any condition satisfied ? if yes please suggest the query. – Sekhar Nov 23 '19 at 16:53

0 Answers0