filter fodder: sql, query Hi all, I feel like I am probly being amazingly stupid, but here goes nothing.
I have 3 tables: "students" "undergrads" "postgrads" "students" holds all common info. eg dt_matric, dob, religion, etc. undergrads hold eg. degree, subject postgrads holds eg. transfer_date, thesis_title What I need to do is something like this (it does _not_ work): set @acyear:='2001'; select students.course_yr, students.dt_start, students.surname, qual_types.abbrv, qual_subjects.name from students, if ( students.st_type='PG',postgrads, undergrads), qual_types, qual_subjects where (postgrads.qskey=qual_subjects.qsid and postgrads.qtkey=qual_types.qtid and postgrads.studentkey=students.studentid) or (undergrads.qskey=qual_subjects.qsid and undergrads.qtkey=qual_types.qtid and undergrads.studentkey=students.studentid) and students.studentid=4; how in "£$%"£$ name can I do this? Donna --------------------------------------------------------------------- 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