Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003

    Unanswered: recursive queries

    I have a following structure

    table A
    userid ReferedBy
    B A
    C B

    Table B
    Userid compID
    A Alpha
    B self
    C self

    now the scenario is :
    the user A is from the company "Alpha"
    he introduces user B, who registers in the system his company bcomes "self",
    now B inturn refers user C who also registers in the system and his company
    is now again "self".
    Now I need to generate a report of number of users that have registered
    under one company, for eg.
    for the company "Alpha" no of users becomes 2 since A refered to two users
    and both of them have registered.

    I m stuck with the query.
    thanks in advance...

  2. #2
    Join Date
    Apr 2004
    Use a tree query - read up on start with/connect by. If you get stuck, post the sql you've written and someone will help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts