Re: MySQL sql query help

2003-03-09 Thread Bruce Feist
Ben Balbo wrote: Seems MySQL doesn't much like having nested joins in joins... Oops! Sorry about that. (Curse me for a MySQL novice! ) However, your principles led me to my result. As the search page will pass the class ids in anyway, I don't need to read these from the table. I.E. I pass the

Re[2]: MySQL sql query help

2003-03-09 Thread Ben Balbo
Hi Bruce, Thanks for your reply. I just got the time to take a look at it, and it makes sense. However, for the first test: SELECT distinct t.name FROM Teacher t INNER JOIN (TeacherClass tc2 INNER JOIN Class c2 ON tc2.classid = c2.id AND c2.name = 'English') ON t.teacherid = tc2.teac

Re: MySQL sql query help

2003-03-07 Thread Bruce Feist
Ben Balbo wrote: Teacher (id, name, ...) TeacherClass (teacherid, classid, timestamp) Class (id, name, ...) Now, what I'd really like to do it find all teachers who, for example, taught Engligh and Math, but not Biology, Here's a general, recursive, untested solution for you to play with. We st

MySQL sql query help

2003-03-07 Thread Ben Balbo
Hi all, I've been trying to wrap my head round this problem for a few days now, and have plenty of pieces of scrap paper with lines and arrows and numbers to prove it. Anyway, here's the scenario: I have a table of teachers, and a table of classes. Any teacher can have taught any class, and any

MySQL sql query help

2003-03-07 Thread Ben Balbo
Hi all, I've been trying to wrap my head round this problem for a few days now, and have plenty of pieces of scrap paper with lines and arrows and numbers to prove it. Anyway, here's the scenario: I have a table of teachers, and a table of classes. Any teacher can have taught any class, and any

MySQL sql query help

2003-03-07 Thread Ben Balbo
Apologies if you now get this three times now, but I haven't received any copies through the mailing list yet, and the first 2 were sent 3 and 4 hours ago. I know email can go walkies for a few hours, but I've not been experiencing any other mail problems, either personally or in receiving MySQL m