B
Brad Granath
I have a table of people, and I have a table of cases.
Each person has a unique ID, first name, last name, address, etc...
Each case has a unique ID, a timestamp, etc...
Each case also has columns for victim #1, victim #2, perp #1, perp#2,
populated by a personID from the people table.
I'd like to query the database for a specific case (as in "WHERE
`case.caseid`=123") and have it return the first and last name of each victim
and each perp (JOINed on `people.personID`=`case.perpID #1` and
`people.personID`=`case.victimID #2`) concatenated together, and
appropriately aliased, but I can't figure out how to properly nest the
selects and/or joins. How does one join the same table on four different
columns?
Thanks!
Each person has a unique ID, first name, last name, address, etc...
Each case has a unique ID, a timestamp, etc...
Each case also has columns for victim #1, victim #2, perp #1, perp#2,
populated by a personID from the people table.
I'd like to query the database for a specific case (as in "WHERE
`case.caseid`=123") and have it return the first and last name of each victim
and each perp (JOINed on `people.personID`=`case.perpID #1` and
`people.personID`=`case.victimID #2`) concatenated together, and
appropriately aliased, but I can't figure out how to properly nest the
selects and/or joins. How does one join the same table on four different
columns?
Thanks!