|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
Join statement
I have three table in my mysql database, student table, studentadvisingrecord table and advisors table. In the student table I have the First_Name, Last_Name, ID, Hold, ect field. In the studentadvisingrecord table, I have ID, Advr_ID field. In the advisor table, I have Advr_ID, Advr_First, Advr_Last field.
I would like select the Student's First, Last Name and Advisor's First, Last Name if the Hold in the Student table is equal to R. The select statement is like below: Select "First_Name, Last_Name, Advr_First, Advr_Last from student, studentadvisingrecord, advisor where((ID=ID) AND (Advr_ID=Advr_ID) AND Hold ='R'"; But it didn't work, any suggestion are welcome!! Thans in advance! |
|
#2
|
|||
|
|||
|
RE: Join statement
First, whenever your query doesn't work, use mysql_error() to see what the problem is..
In your case, you don't specify which ID should equal which ID. And you also have some "'s which you don't need: Select First_Name, Last_Name, Advr_First, Advr_Last from student, studentadvisingrecord, advisor where((student.ID=studentadvisingrecord.ID) AND (studentadvisingrecord.Advr_ID=advisor.Advr_ID) AND Hold ='R'; |
|
#3
|
|||
|
|||
|
RE: Join statement
Thank you very much!!
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Join statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|