pratibharao
asked on
Help decode function multiple tables
Hi,
I need to run a calculation and plot graphs using a different application off the data I retrieve from two separate tables. The idea is to plot complaints generated from each of the sources in a common bar graph over a time period. For ex, If on a particular day, AOL generated 300 complaints and MSN generated, 200 complaints, I would run a calculation that probably gave a result of 3 and 2 respectively for the two providers and on the bar graph, the aol complaints will be displayed from 0-3 and yahoo complaints from 3-5. This will repeat for all the days chosen.
I am trying to use DECODE to select the providers. This is my query:
select DECODE(T1.DOMAINNAME, 'aol.com',
DECODE(T2.DOMAINNAME, 'aol.com', ((T1.TOTAL_COMPLAINTS)/T2. SENT/10000 00)))
)as y#COMPLAINTRATIO
FROM TABLE1 T1, TABLE2 T2
WHERE TRUNC(T2.SENT_DATE) = to_date('08/12/2004','MM/D D/YYYY')
AND TRUNC(T1.SENT_DATE) = to_date('08/12/2004','MM/D D/YYYY')
What I seem to be getting is a some sort of a sum and not the answer for aol for that particular day. I cannot achieve the same using where clause for the reasons mentioned above.
Please help!
Thank you,
Pratibha
I need to run a calculation and plot graphs using a different application off the data I retrieve from two separate tables. The idea is to plot complaints generated from each of the sources in a common bar graph over a time period. For ex, If on a particular day, AOL generated 300 complaints and MSN generated, 200 complaints, I would run a calculation that probably gave a result of 3 and 2 respectively for the two providers and on the bar graph, the aol complaints will be displayed from 0-3 and yahoo complaints from 3-5. This will repeat for all the days chosen.
I am trying to use DECODE to select the providers. This is my query:
select DECODE(T1.DOMAINNAME, 'aol.com',
DECODE(T2.DOMAINNAME, 'aol.com', ((T1.TOTAL_COMPLAINTS)/T2.
)as y#COMPLAINTRATIO
FROM TABLE1 T1, TABLE2 T2
WHERE TRUNC(T2.SENT_DATE) = to_date('08/12/2004','MM/D
AND TRUNC(T1.SENT_DATE) = to_date('08/12/2004','MM/D
What I seem to be getting is a some sort of a sum and not the answer for aol for that particular day. I cannot achieve the same using where clause for the reasons mentioned above.
Please help!
Thank you,
Pratibha
I'm not sure I understand. What info does table 1 have versus table 2?
What is in this tables?
Where is your join condition?
Where is your join condition?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.