There's a new release candidate version of Hive that includes windowing functions that address this. RC1 is available at http://people.apache.org/~hashutosh/hive-0.11.0-rc1/. Also see https://issues.apache.org/jira/browse/HIVE-896
Without 0.11 the approach from Paul will work, but will be slow. On Wed, May 15, 2013 at 7:53 AM, Paul COURTOIS <p...@pole-conseils.com> wrote: > Hi Bhathiya, > > what about cartesian product ? > > the idea would be something like that : > select a, b, c from t1 > join t1 as t2 on t2.a = t1.a > where t2.b > t1.b > > it's not very "elegant", but should work ;-) > > Paul > > > 2013/5/15 Bhathiya Jayasekara <tobhathi...@gmail.com> >> >> Hi all, >> >> Can someone please give an idea for this? I'm totally stuck. >> >> >> http://stackoverflow.com/questions/16558438/in-hive-how-to-do-a-calculation-among-2-rows >> >> Thanks. >> >> --Bhathiya > >