【问题标题】:In an employee table, if manager id and employee id is same, then get the manager names for employee在员工表中,如果经理 ID 和员工 ID 相同,则获取员工的经理姓名
【发布时间】:2022-12-12 23:40:20
【问题描述】:

我试过做内部连接。但我必须使用 SQL 过程显示结果 我试过使用内部连接,但我期待程序

【问题讨论】:

    标签: oracle11g oracle10g


    【解决方案1】:

    在员工表中,如果经理 ID 和员工 ID 相同,则获取员工的经理姓名

    如果员工的id与经理的id相同,并且每个员工都有一个唯一的id,那么经理的名字就是员工的名字,您可以使用:

    SELECT name
    FROM   employee
    WHERE  employee_id = manager_id;
    

    【讨论】:

      猜你喜欢
      • 2017-01-07
      • 1970-01-01
      • 1970-01-01
      • 2019-02-13
      • 1970-01-01
      • 2021-09-08
      • 2022-11-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多