Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
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  
Old March 20th, 2003, 09:51 PM
baiyanh baiyanh is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 23 baiyanh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!

Reply With Quote
  #2  
Old March 21st, 2003, 06:43 AM
xs0 xs0 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Ljubljana, Slovenia
Posts: 760 xs0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 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';

Reply With Quote
  #3  
Old March 21st, 2003, 07:35 PM
baiyanh baiyanh is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 23 baiyanh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Join statement

Thank you very much!!

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Join statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway