Q:

How to query between two tables using IF(condition, tableA, tableB) in Hive?

I want to do a query based on a logic condition to query between two tables.
select *
from if(1>2, tableA, tableB)

1>2 above is simply one example logic test, it can be any logic value.
But if function in Hive cannot work within FROM above. Any idea how?

A:

Use this pattern:
select * from tableA where 1>2
union all
select * from tableB where 1<2; 

Which query will be running depends on the WHERE condition.

