• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tree structure problem

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
i have the following table having
EMP BOSS SALARY
--------------- --------------- ----------
Albert NULL 1000
Bert Albert 900
Chuck Albert 900
Donna Chuck 800
Eddie Chuck 700
Fred Chuck 600
Faisal Fred 400

it create a tree structure , and i want to write select statement to get
all employees whose boss is chuck
like donna , eddie, fred and faisal too, bcs fred boss is also Chuck
please help me in solving the problem
Faisal
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Faisal,
You are going to need more than one query. First, you get all the employees whose direct boss is Chuck. Then, you get the employees that have a boss that was returned by your first query. Repeat until your queries don't return any results.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic