1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Oracle SQL, display colleagues who work in the same dept. as a given employee

Discussion in 'Software Development' started by ElementOfMagic, Jan 30, 2013.

Thread Status:
Not open for further replies.
  1. ElementOfMagic

    ElementOfMagic Thread Starter

    Joined:
    Dec 30, 2012
    Messages:
    52

    Hello. :)

    I am currently working in Oracle SQL Developer and I need to create a report that displays employee last names, department ID's, and all the employees (under the name of "Colleagues") who work in the same department as a given employee.

    This is what I have so far, it seems to be giving me an error at line 5 for some reason.

    Code:
    select
    department_id AS dept_id,
    department_name AS "Dept_Name",
    last_name AS "Employee" from departments,
    [COLOR="Red"]last_name AS "Colleague" from departments where department_id = '&department_id'[/COLOR]
    natural join employees;
    
    Any help/guidance would be appreciated. :)
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1087587

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice