I am facing a hive problem.
- I will get a 0 or 1 after from sql
"select count(*) from table1 where ..."
- If the result is 1, then I will execute the sql
"Insert Into table2 partition(d) (select xxxx from table 1 where ... group by t)"
Otherwise do nothing.
My question is how can I write these two sql together into one sql. I am only allowed to write a single long sql.
I tried to put the first sql into the where condition in sql2, but it throwed an error said it's not supported to operat on table1 in the subquery (couldn't remember clearly, something like this).
It sounds like a very easy question for experienced programmers, but I just started lerning hive for 2 days.