Hi,
I have a requirement in Oracle using Decode function with Rownum. I need to convert this into Teradata. I need help in this. I tried using Top function and Rank qualify but unable to do the same. Please help me in this.
sample query in Oracle is:
SELECT DECODE(ROWNUM, 1, party, 2, party, 3, party, 4, party, 5, party,6, party, 7,party,'Others') party,
mnth,SUM(qty) FROM
(
SELECT NVL(trim(b.Party_name),'Others') party, c.MONTH_ID mnth, SUM(a.qty) qty
FROM tablea a,tableb b,tablec c
WHERE a.col1 = b.col1
AND a.col2 = c.col1
AND a.col3='Y'
GROUP BY party,mnth
ORDER BY SUM(a.qty) DESC
)
GROUP BY DECODE(ROWNUM, 1, party, 2, party, 3, party, 4, party, 5, party, 6, party, 7, party, 'Others'),mnth
Please help me the conversion of outer query in Teradata. Thanks in Advance.
Thanks and Regards, TDHelp.