-Union in Multi Insert
John Omernik 2013-02-12, 03:34
I am trying to do a union, group by, and multi insert all at once. I know
this convoluted but I what I am trying to do is avoid having to scan
through the original table more than once... if I can get all my data from
two columns that I want to pull together, in one round of mappers, I win...
Basically, col2 and col3 are they type of data, one is src, one is dst, I
want a single record for every uniq value of both col2 and col3.
col1, col2, col3, col4
INSERT overwrite TABLE table_summary
select col1, unioned_col, count(1), count(distinct col4) from
(select col1, col2 as unioned_col, col4
select col1, col3 as unioned_col, col4
group by col1, unioned_col
Mark Grover 2013-02-12, 05:08
John Omernik 2013-02-12, 14:59