Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2013
    Posts
    57

    Unanswered: multiple joins-what am I doing wrong?

    Display the mortals on the Realmed Test Plan2. Arrange the result by name.

    MY CODE:

    Code:
    select (mortal.first_name || ' ' || mortal.last_name) as Mortal_Name
    from mortal join insured on mortal.mortal_id = insured.mortal_id
     join policy on insured.policy_id = policy.policy_id
     join plan on policy.plan_id = plan.plan_id
    where upper(plan.plan_name) = 'REALMED TEST PLAN2'
    order by (mortal.first_name || ' ' || mortal.last_name);
    The tables:

    Code:
    SQL> desc mortal
     Name
     ------------------------
     MORTAL_ID
     SEX_TYPE_CODE
     FIRST_NAME
     LAST_NAME
     DOB
     MARITAL_STATUS_CODE
     SSN
     MIDDLE_NAME
     WORK_PHONE
    
    SQL> desc insured
     Name
     ------------------------
     INSURED_ID
     INSURED_TYPE_CODE
     POLICY_ID
     MORTAL_ID
     BANK_ACCOUNT_NUM
     INSURED_NUM
    
    SQL> desc policy
     Name
     ------------------------
     POLICY_ID
     PLAN_ID
     POLICY_STATUS_TYPE_CODE
     PAYER_GROUP_ID
     EFFECTIVE_DATE
     POLICY_NUM
     EXPIRE_DATE
    
    SQL> desc plan
     Name
     ------------------------
     PLAN_ID
     PAYER_ID
     PLAN_NAME
     EFFECTIVE_DATE
     PLAN_NUM
     EXPIRE_DATE
     DSCR

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    post CREATE TABLE statement for each table

    since we don't have your tables or data, we can not run posted code.

    what is the expected/desired results?
    Last edited by anacedent; 10-10-13 at 22:27.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Sep 2013
    Posts
    57
    Quote Originally Posted by anacedent View Post
    post CREATE TABLE statement for each table

    since we don't have your tables or data, we can not run posted code.

    what is the expected/desired results?
    I gave the tables contents, above.......

  4. #4
    Join Date
    Sep 2013
    Posts
    57
    the idea is to list 'mortals' who use the 'realmed2' insurance.

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >I gave the tables contents, above.......
    I can't run SQL against what you posted.
    If you expect/desire assistance, you need to make it easy to provide answers to you.

    >the idea is to list 'mortals' who use the 'realmed2' insurance.
    does this include Snoopy, Charlie Brown, Lucy & Linus?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  6. #6
    Join Date
    Dec 2007
    Posts
    253
    What makes you think that you're doing something wrong?
    Are you getting an error?
    Are the results not coming out correctly?
    As anacedent says, post create table, insert scripts and expected results along with an explanation as to how those results come from the supplied data.

Tags for this Thread

Posting Permissions

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