1
PSOUG / analytical function question
« on: April 06, 2009, 12:08:13 am »
Hi all,
I am trying to find out if I can use the analytical functions to perform the following:
I have a table that has two columns
---------------------------
customer_id | partner_id |
---------------------------
Customer_id has the unique index.
Hence one vendor can have more than one customer.
If I need to have the data for the distribution or histogram, I can easily do it with the simple SQL code:
select total_customers, count(total_customers) from (
select count(vendor_id) total_customers, partner_id from table_a group by parnter_id_id order by total_customers desc )
group by total_customers
And I will be able to do have the distribution of customers/ per partners.
Is that possible to do the same using Oracle analytical functions?
Also, I need to know if I need a scale of 5, not 1?
e.g. how many partners have 1-5 contacts, 6-10 contacts etc...
Any help would be greatly appreciated!!!
thanks,
alex
I am trying to find out if I can use the analytical functions to perform the following:
I have a table that has two columns
---------------------------
customer_id | partner_id |
---------------------------
Customer_id has the unique index.
Hence one vendor can have more than one customer.
If I need to have the data for the distribution or histogram, I can easily do it with the simple SQL code:
select total_customers, count(total_customers) from (
select count(vendor_id) total_customers, partner_id from table_a group by parnter_id_id order by total_customers desc )
group by total_customers
And I will be able to do have the distribution of customers/ per partners.
Is that possible to do the same using Oracle analytical functions?
Also, I need to know if I need a scale of 5, not 1?
e.g. how many partners have 1-5 contacts, 6-10 contacts etc...Any help would be greatly appreciated!!!
thanks,
alex