Hey folks-

'nother question.
I'm not an SQL expert, and I think I need a subselect, which means I need a
workaround on MySQL 3.23 or whatever version it is.

Here's the tables I have, with the relevant columns:

Students
 - Name
 - StudentID (PK)
 - ClassID

Classes
 - ClassID (PK)
 - Name

 Each Student belongs to one class.


So, I have the StudentID. I want to get the Classes.Name...
Final result should look like

Student | Class
--------------------------
Steve Lefevre | Math101
Stacy Adams | Intro to SQL

Something like

SELECT Student.Name, Classes.Name FROM Students, Classes WHERE
Students.StudentID = " . $ID . " AND Classes.Name IN ( SELECT Classes.Name
FROM Classes WHERE ClassID = Students.ClassID )

I know that probably won't work as a subselect query, but that's my starting
point.

Any help? Thanks!

Steve


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to