Problem with Join

  • Folks,

    I have six tables namely.

    Inmate- inmate_id,person_id,name

    person- person_id,

    personnel- personnel_id,person_id

    Grievance- Grievance_id,Inmate_id

    grievance_inmate - grievance_id,Inmate_id

    grievance_personnel -personnel_id,grievance_id

    where i should pass Grievance_inmate.inmate_id for name and Grievance_personnel.personnel_id for personnel

    I need to get result Like

    Name Personnel

    Sam Frank

    Ram -----

    Could anyone help me out with this challenging task

    Regards,

    Leo Franklin.M

  • This should get you started, as it links 2 of the 6 tables you've presented. From this you should be able to expand the select to get your desired results.

    select i.name, g.whatever_field_you_need

    from inmate i

    left join grievance g

    on i.inmate_id = g.inmate_id

    I'm not sure where the result you want for "Personnel" is stored. More detail is needed, like all the tables DDL, sample data for each table and expected results based on your sample. Kind of difficult to help with the limited info that you've provided.

    -- You can't be late until you show up.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply