I have a DB with multiple tables. Table 'Demo' contains student information - then there are multiple quiz tables named 'Quiz1', 'Quiz2', etc. and these contain the quiz scores for this module and the name of the instructor that taught this quiz module. Hope this makes sense... So, I have a search screen where the user can fill in fields and I construct an SQL query based on the fields they filled in. I am having a problem though - how could I let them type in an instructors name for instance? I need to select the student info. from the 'Demo' table and then info from multiple Quiz tables too. I can't figure out how to do this. My SQL statement is going something like:
Select * from Demo,Quiz1 Where Demo.ID=Quiz1.ID and Quiz1.InstName='John Paul'
That's not so bad but how do I query more tables based on the InstName field - each Quiz table has an InstName field.
Would I do:
Select * from Demo,Quiz1,Quiz2 Where Demo.ID=Quiz1.ID and Demo.ID=Quiz2.ID and Quiz1.InstName='John Paul' or Quiz2.InstName='John Paul'
That would get awfully unwieldy if I had say 10 Quiz Tables. I'm using my own ID field, FWIW.
Am I missing something? Is there an easier way to do this query?
Dave
------------------------------------------------------------- The Valentina mailing list is brought to you by MacServe.net For info on lists services, see http://www.macserve.net/lists.html ©2001 Mennenoh, David |