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: SQL*Plus and PL/SQL >> can u write a query for this

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: can u write a query for this
 Rajiv  Posted: Nov 06, 2006 02:44:28 AM

 Total Post: 4
 Joined: Nov, 2006






 dear snehalata,
can u write aquery for this....

Suppose we have a Table with data like this: father and son r col names

Father Son

Ram Kumar

Ram Shyam

John Michael

John Michael


Find out all the fathers (along with their son ) who have more than one son, name of the father should not be duplicated. In this example, answer should come out as:



Ram Kumar

Ram Shyam




 snehalatha
Posted: Nov 06, 2006 03:17:42 AM  

 Total Post: 169
 Joined: Apr, 2006






 


This Query Selects the Fathers info who have more than one son and eliminates the duplicates

SELECT FATHER,SON FROM TEMP_TABLE
WHERE FATHER in (SELECT FATHER from TEMP_TABLE
GROUP BY FATHER
having count(*)>1)
GROUP BY FATHER,SON
having count(*)=1



 Rajiv
Posted: Nov 07, 2006 01:59:37 AM  

 Total Post: 4
 Joined: Nov, 2006






 
Dear Snehalata,
Thanks very much for the Querry ..
reagrds
rajiv

 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 Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gopu Gopi334
  Gitesh Trivedi322
  Vinoth Kumar264
  neeraj sharma258
  Ramesh Jois246






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