Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2013
    Posts
    25

    Unanswered: Join between tables

    Hi All,

    I have a table pa_master_details and lov_details.

    In the pa_master_details table, I have role_comp_emp_final_rating and role_comp_lm_final_rating columns.

    In the lov_details table I have a column rating lov_value and lov_text_en.

    I need to join role_comp_emp_final_rating with the lov_value column to get lov_text_en Based on this lov_value, I need to show lov_text_en from the lov_details table.

    So I wrote a query like this and am getting the result for emp rating:

    SELECT p.employee_number,
    p.role_comp_emp_final_rating,
    lov_text_en,
    p.role_comp_lm_final_rating
    FROM pa_master_details P, lov_details L
    WHERE p.role_comp_emp_final_rating = l.lov_value
    AND p.employee_number = 34570
    Similarly, I need to show lov_text_en for role_comp_lm_final_rating from the lov_details table by joining role_comp_lm_final_rating with lov_value in the same query.

    How do I do it?

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >How do I do it?

    How will you, I, or anyone know when correct SQL has been posted?

    Since we don't have you tables or data, we can't run, test or improve posted SELECT.
    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
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Code:
    SELECT p.employee_number,
           p.role_comp_emp_final_rating,
           l.lov_text_en,
    p.role_comp_lm_final_rating,
    l2.lov_text_en
    FROM pa_master_details P, lov_details L, lov_details L2
    WHERE p.role_comp_emp_final_rating = l.lov_value
    and  role_comp_lm_final_rating = l2.lov_value
    AND p.employee_number = 34570
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

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
  •