lapubell
June 25th, 2009, 10:47 PM
hello rad developers.
I'm having trouble working with three tables in a mysql database. working with a smarter programmer than me, I set up my tables so that they work really well, when I can get it figured out. He's not around today, and he usually helps he set up the joins. After googleing and reading the mysql docs and the tiztag tutorials (usually pretty good) I can't get this thing to work right.
Three tables:
table 1 - instructors (truncated to show good data)
id - first - last - ...
1 - Joe - Smith - ...
2 - John - whatever...
table 2 - students (almost identical to instructors)
id - first - last - ...
1 - Sally - ASDF - ...
2 - Billy - whatever...
table 3 - lessons (looks something like this):
id - student_id - instructor_id - ...
1 - 1 - 2 - ...
2 - 1 - 1 - ...
so i'm trying to get the students and instructors first and last names replacing the student_id and instructor_id when i query the lessons table. do i use a left join? if so, which table is the far left? anyone want to help me out? if there is a rad tutorial that is super dumbed down, I would love that link too.
Thanks in advance!
I'm having trouble working with three tables in a mysql database. working with a smarter programmer than me, I set up my tables so that they work really well, when I can get it figured out. He's not around today, and he usually helps he set up the joins. After googleing and reading the mysql docs and the tiztag tutorials (usually pretty good) I can't get this thing to work right.
Three tables:
table 1 - instructors (truncated to show good data)
id - first - last - ...
1 - Joe - Smith - ...
2 - John - whatever...
table 2 - students (almost identical to instructors)
id - first - last - ...
1 - Sally - ASDF - ...
2 - Billy - whatever...
table 3 - lessons (looks something like this):
id - student_id - instructor_id - ...
1 - 1 - 2 - ...
2 - 1 - 1 - ...
so i'm trying to get the students and instructors first and last names replacing the student_id and instructor_id when i query the lessons table. do i use a left join? if so, which table is the far left? anyone want to help me out? if there is a rad tutorial that is super dumbed down, I would love that link too.
Thanks in advance!