Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Location
    Winston-Salem, NC
    Posts
    25

    Unanswered: Select Statement Help

    2 rows of data in job table:
    joid=111 <-- unique identifier
    job_name=JOB1
    job_type=b

    joid=222
    job_name=JOB2
    job_type=c
    box_joid=111

    joid=333
    job_name=JOB3
    job_type=c
    box_joid=111

    Here is my problem:

    I want to have this select statement show me job_name and the "box name".

    SELECT job_name,box_joid from job where job_name=JOB2

    Right now, box_joid would show up as 111 in this statement. I want it to show up as JOB1 and that's where I'm stuck at. I don't know how to make the box_joid not show up as a number, but as the actual job_name of the job in which the box_joid=joid. I hope that makes sense.

    Any help would be greatly appreciated.

    Thanks,
    Jeff

  2. #2
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    You mean something like this?
    Code:
    SELECT
        j1.job_name as job_name
        ,j2.job_name as box_name
    FROM
        job j1
        ,job j2
    WHERE
        j1.job_name = "JOB2"
        AND
        j1.box_joid = j2.job_id
    Or you may want to use an outer join.

Posting Permissions

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