How to: retreive school name using school id

How to: retreive school name using school id

am 22.04.2006 17:52:47 von jullietta.jung

HI,

I have a Questionnaire table that has a column "SchoolId"(int).
I want to return the questionnaire table with the name of the school
rather than the SchoolId (schoolid and schoolName are stored in another
table).

Hope this makes sense.
Thanks
Jules

Re: How to: retreive school name using school id

am 22.04.2006 18:25:47 von jullietta.jung

Sorry I should add that there are 2 schoolId coloumns in the
questionnaire table.
I school id for the visiting school and another for the home school.

- Jules

Re: How to: retreive school name using school id

am 23.04.2006 01:57:25 von Bill Karwin

jullietta.jung@gmail.com wrote:
> HI,
>
> I have a Questionnaire table that has a column "SchoolId"(int).
> I want to return the questionnaire table with the name of the school
> rather than the SchoolId (schoolid and schoolName are stored in another
> table).

Sounds like you need to make a join between the two tables:

SELECT s.schoolName, q.question, q.answer
FROM school AS s JOIN questionnaire AS q USING (SchoolId)

Regards,
Bill K.