Results 1 to 2 of 2

Thread: Use ID to select info from other table

  1. #1
    Join Date
    Jun 2005
    Posts
    1

    Use ID to select info from other table

    I have two tables:

    - Employees
    id|name
    1.|Peter
    2.|Andre
    3.|Vincent

    - Departments
    id|department|employee
    1 finance | 2
    2 sales | 1

    I am looking for a query that results the table Departments to show the actual name of the employee instead of a number by using the number (id).

    Please help

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Try something like:

    select department, e.name as employee from Departments d join Employees e on d.employee = e.id where ...

Posting Permissions

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