From: Lefevre, Steven <[EMAIL PROTECTED]> > ...I think I need a subselect...
It's rare that a sub-select is actually ~needed~, but it does happen. You can almost always get around it with a JOIN of some sort. > Final result should look like > Student | Class > -------------------------- > Steve Lefevre | Math101 > Stacy Adams | Intro to SQL How about: SELECT Students.Name as Student, Classes.Name as Class FROM Students, Classes WHERE Students.ClassID = Classes.ClassID On a side note: Some of your schema naming will eventually cause you trouble, or at least win you some grief from other programmers. - A common idiom is to name a table for what ONE record of data will represent. That means that you'd name the table that holds student information as 'student' instead of 'Students' since one record only contains one student. - It's a bit redundant to have to say 'Students.StudentID'. It might make more sence to readers to see 'student.id' and 'student.class_id'. - You'll notice that I've been using all lower case names. MySQL will allow loose case of column names, but not table names. So, you can say: SELECT name FROM Students; But not: SELECT Name FROM students; If you always use lower case, then you and your co-workers will always know how to type in names without having to get out a copy of the schema first. OK, I'll stop preaching now. Let us know if you need more help with this. --- Rodney Broom President, R.Broom Consulting http://www.rbroom.com/ sql --------------------------------------------------------------------- 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