-----Original Message-----
From: Lefevre, Steven [mailto:[EMAIL PROTECTED]]
>
> 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
>

Hi Steve, try

SELECT `Students`.`Name` AS "Student", `Classes`.`Name` AS "Class" FROM
`Students` LEFT JOIN `Classes` USING `ClassID`;

Regards,

Alexander




---------------------------------------------------------------------
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