I think my problem is solved with a 'recursive query', but since MySQL doesn't support recursive queries I was trying to use the adjacent list model. This should not be a problem since I know how deep I want to go.
Here's an example of what I need to do: Table Classes:
dept classNum prereqDept prereqClassNum
BIO 465 BIO 335
EE 405 EE 325
EE 325 EE 120
BIO 465 EE 120
BIO 335 BIO 225
BIO 225 CHEM 110
BIO 225 BIO 105
What I need is all the classes of a certain level (let's say 400) with all their prerequisites up to 3 levels deep. So I'd get something like
dept classNum prereqDept prereqClassNum
BIO 465 BIO 335
BIO 465 BIO 225
BIO 465 CHEM 110
BIO 465 BIO 105
EE 405 EE 325
EE 405 EE 120
....
I know I need to use 3-LEFT JOINs if I want to go 3 levels deep, but I can't figure out how to set up these joins to get what I need. Any ideas? I'll appreacite your help!
P.S. I can't change the table structure at all.
