you want to flatten the query I understand. create temporary table tmp as select c from d;
INSERT INTO TABLE a SELECT c from tmp where condition Is the INSERT code correct? HTH Dr Mich Talebzadeh LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw <https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>* http://talebzadehmich.wordpress.com On 13 June 2016 at 17:55, Aviral Agarwal <aviral12...@gmail.com> wrote: > Hi, > I would like to know if there is a way to convert nested hive sub-queries > into optimized queries. > > For example : > INSERT INTO TABLE a.b SELECT * FROM ( SELECT c FROM d) > > into > > INSERT INTO TABLE a.b SELECT c FROM D > > This is a simple example but the solution should apply is there were > deeper nesting levels present. > > Thanks, > Aviral Agarwal > >