Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

complex group by query

Saaz EnaJul 21 2008 — edited Jul 21 2008
Hi,

Pls someone help me to solve the below query


SQL> SELECT FACILITY_TYPE, CONTACT_TYPE, POI FROM POI ORDER BY FACILITY_TYPE, CONTACT_TYPE; FACILITY_TYPE CONTACT_TYPE POI------------------------------ ------------ ----------Auto Service and Maintainance 1 53Auto Service and Maintainance 1 44Auto Service and Maintainance 3 44Auto Service and Maintainance 4 53Auto Service and Maintainance 4 53Auto Service and Maintainance 4 44Auto Service and Maintainance 5 44Auto Service and Maintainance 5 53Auto Service and Maintainance 5 53Clothing Store 3 51Clothing Store 3 51Golf Course 1 40Golf Course 1 40Golf Course 1 40Golf Course 3 40 15 rows selected


The output shold look like


FACILITY_TYPE CONTACT_TYPE COUNT_GP_POI COUNT_PER_POI------------------------------ -------------------- ------------ -------------Auto Service and Maintainance 1 2 1Auto Service and Maintainance 4 1 1Auto Service and Maintainance 3 1 1Auto Service and Maintainance 3 1 2Auto Service and Maintainance 5 1 1Auto Service and Maintainance 5 1 2Clothing Store 3 1 2Golf Course 5 1 3Golf Course 3 1 1Total Auto Service n Maint POI 2 Total Clothing Store POI 1 Total Golf Course POI 1 12 rows selected


Thanks in Advance
Saaz
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2008
Added on Jul 21 2008
13 comments
1,541 views