SQL Query Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • furqanms
    New Member
    • Jun 2007
    • 17

    SQL Query Problem

    Hello Friends

    I have following data in the table.


    ID--------Name---------Code
    ---------------------------------------------
    1---------Stone------------0
    2---------Jewelry----------0
    3---------Color Stone----1
    4---------Ruby-------------3

    Here 0 stands for primary type (stone) now I want to search primary type for ruby which is stone so how can I get that through sql query.

    Thanking you in Advance

    Waiting for your response
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    Here 0 stands for primary type (stone) now I want to search primary type for ruby which is stone
    Nope, re-read this over but doesn't make sense.
    It may help if you used meaningful field names

    Comment

    • furqanms
      New Member
      • Jun 2007
      • 17

      #3
      Originally posted by code green
      Nope, re-read this over but doesn't make sense.
      It may help if you used meaningful field names
      [HTML]<pre>
      Stone
      /\
      colorstone Pearl
      / \
      Ruby
      </pre>
      [/HTML]


      Now I want to search Root node(stone) from leaf node(ruby).In the table code stand for level where 0 means root node.

      Comment

      Working...