Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. [MySQL] How to SELECT direct and indirect staff

[MySQL] How to SELECT direct and indirect staff

Scheduled Pinned Locked Moved Database
salesquestiondatabasemysqlcom
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    Hi, I have a Marketing & Sales Director, the Marketing & Sales Director has one Marketing Manager and Sales Manager reporting to him. The Sales Manager has two Sales Executives and the Marketing Manager has two Marketing coordinators reporting to them. I can make a SELECT to list staff reporting to the Sales Manager and staff reporting to the Marketing Manager. I can also make a SELECT to list staff reporting to the Marketing & Sales Director (which are Marketing Manager and Sales Manager). Now I want to make a SELECT to list all staff reporting directly on indirectly to the Marketing & Sales Director including staff reporting to managers under the Marketing & Sales Director so the query should list the below when I query for staff reporting to the Marketing & Sales Director: 1. Marketing Manager 2. Sales Manager 3. Sales Executive 1 4. Sales Executive 2 5. Marketing Coordinator 1 6. Marketing Coordinator 2 How can I do this please? Thanks, Jassim[^]

    Technology News @ www.JassimRahma.com

    Kornfeld Eliyahu PeterK J 2 Replies Last reply
    0
    • J Jassim Rahma

      Hi, I have a Marketing & Sales Director, the Marketing & Sales Director has one Marketing Manager and Sales Manager reporting to him. The Sales Manager has two Sales Executives and the Marketing Manager has two Marketing coordinators reporting to them. I can make a SELECT to list staff reporting to the Sales Manager and staff reporting to the Marketing Manager. I can also make a SELECT to list staff reporting to the Marketing & Sales Director (which are Marketing Manager and Sales Manager). Now I want to make a SELECT to list all staff reporting directly on indirectly to the Marketing & Sales Director including staff reporting to managers under the Marketing & Sales Director so the query should list the below when I query for staff reporting to the Marketing & Sales Director: 1. Marketing Manager 2. Sales Manager 3. Sales Executive 1 4. Sales Executive 2 5. Marketing Coordinator 1 6. Marketing Coordinator 2 How can I do this please? Thanks, Jassim[^]

      Technology News @ www.JassimRahma.com

      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu Peter
      wrote on last edited by
      #2

      Your signature (Jassim) points to a site seems to be commercial... It is not really accepted here and can cause you to be banned for spamming... Please remove it (or restore it to its previous value - your personal site)!

      Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

      "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

      M 1 Reply Last reply
      0
      • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

        Your signature (Jassim) points to a site seems to be commercial... It is not really accepted here and can cause you to be banned for spamming... Please remove it (or restore it to its previous value - your personal site)!

        Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        I suspect it may be a site he created, or at least customised the template for!

        Never underestimate the power of human stupidity RAH

        1 Reply Last reply
        0
        • J Jassim Rahma

          Hi, I have a Marketing & Sales Director, the Marketing & Sales Director has one Marketing Manager and Sales Manager reporting to him. The Sales Manager has two Sales Executives and the Marketing Manager has two Marketing coordinators reporting to them. I can make a SELECT to list staff reporting to the Sales Manager and staff reporting to the Marketing Manager. I can also make a SELECT to list staff reporting to the Marketing & Sales Director (which are Marketing Manager and Sales Manager). Now I want to make a SELECT to list all staff reporting directly on indirectly to the Marketing & Sales Director including staff reporting to managers under the Marketing & Sales Director so the query should list the below when I query for staff reporting to the Marketing & Sales Director: 1. Marketing Manager 2. Sales Manager 3. Sales Executive 1 4. Sales Executive 2 5. Marketing Coordinator 1 6. Marketing Coordinator 2 How can I do this please? Thanks, Jassim[^]

          Technology News @ www.JassimRahma.com

          J Offline
          J Offline
          Jorgen Andersson
          wrote on last edited by
          #4

          Not enough info, how's your tables looking like?

          Wrong is evil and must be defeated. - Jeff Ello

          J 1 Reply Last reply
          0
          • J Jorgen Andersson

            Not enough info, how's your tables looking like?

            Wrong is evil and must be defeated. - Jeff Ello

            J Offline
            J Offline
            Jassim Rahma
            wrote on last edited by
            #5

            In employees table: 1. employee_number 2. first_name 3. last_name In employee_job 1. employee_number 2. reporting_to (refers to employees->employee_number)

            Technology News @ www.JassimRahma.com

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups