Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: Oracle Certified Professional Exams (OCP & OCA) >> Need a answer for a Query....

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: Need a answer for a Query....
 priya  Posted: Apr 17, 2007 02:10:43 AM

 Total Post: 39
 Joined: Apr, 2007






 TABLE 1 -
CUSTOMER ID ACCNT NUMBER
1 A1
1 B1
1 c1
2 A2
3 A3
3 B3
4 C1


TABLE 2-

ACCNT NUMBER BANK NAME
A1 HSBC
B1 ICICI
C1 HSBC
A2 HSBC
A3 HSBC
B3 ICICI
C1 HSBC



What is the query to print the customer IDs who have accounts in ALL the banks


(IN THIS INSTANCE THE QUERY SHOULD RETURN 1 AND 3)

 gps
Posted: Apr 17, 2007 07:45:49 AM  

 Total Post: 38
 Joined: May, 2006






 
Try this query ...


select customer_id
from (select customer_id,bank_name from table1 a, table2 b
where a.account_no=b.account_no
group by customer_id,bank_name)
group by customer_id having count(*)=
(select count(distinct bank_name) from table2)



Gurwinder

 priya
Posted: Apr 17, 2007 07:56:27 AM  

 Total Post: 39
 Joined: Apr, 2007






 
hi,

thanks verymuch..

got it.

priya

 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar814
  Mohammed Taj694
  Jayanta Sur479
  Vigyan Kaushik386
  positive fanatic361
  Gitesh Trivedi322
  Gopu Gopi239
  neeraj sharma228
  Ramesh Jois226
  snehalatha p169






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software