Query using group

From: Prasath <prasath.rao_at_gmail.com>
Date: Wed, 23 Apr 2008 05:35:58 -0700 (PDT)
Message-ID: <759a19db-f32c-4f80-94a8-953461f37fcc@l42g2000hsc.googlegroups.com>


i have a table with 4 columns, they look like

currency1 currency2 amt1 amt2



USD GBP 10 9
GBP USD 5 8
JPY INR 20 7
INR JPY 14 100 i want to cross add the amounts for each group of currency1 and currency2. now, the currency groups are bit unusal. For example, the first two rows in the above table fall under the group USD+GBP (or GBP+USD, the other does not matter)

the result should look like

currency1 currency2 sum1 sum2
USD GBP 18 14 (from 10+8 and 9+5)
INR JPY 120 21 (from 20+100 and 14+7)

any ideas? Received on Wed Apr 23 2008 - 07:35:58 CDT

Original text of this message