main logo
Subject: Re: Need some advice
Author: erne
Posted: 2001/05/30 02:42:17
 
View Entire Thread
New Search


In date 30-05-2001 0:10, Mennenoh, David wrote:

Hello David,

> 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...

why don't keep quiz in 1 table
and give them an idnumber

> 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'
>

so the query would be some like
Select * from Demo,Quiz Where Demo.ID=Quiz.ID and Quiz.idnumber = 1 and
Quiz.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'
>

and this would become
Select * from Demo,Quiz Where Demo.ID=Quiz.ID and (Quiz.idnumber = 1
or Quiz.idnumber = 2) and Quiz.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?
>


just an idea


Cool Runnings,
Erne.

| e r | Ernesto Giannotta
| n e | Musical Box - a media store




-------------------------------------------------------------
The Valentina mailing list is brought to you by MacServe.net
For info on lists services, see http://www.macserve.net/lists.html
 
©2001 erne
<-- Prior Message New Search Next Message -->