I have two tables A and B. Both has same column names. I want to merge these two table and load it to table C. Table C also have same column names as A and B and one more column in timestamp (this for capturing the merged time). I dont want duplicates in Table C. I tried union but getting duplicate values because one of the column in Table C in Timestamp data type.
For Example, below is my sample query
insert overwrite table TableC
select field1,field2, unix_timestamp() as field3 from table_A
UNION
select field1,field2, unix_timestamp() as field3 from table_B
The two unix_timestamp() function returns different timestamps (just a milli second difference) and I am getting duplicate data because of the timestamp.
Is there anyother way to get the same timestamp for both functions while union ?