join question

Claudius Sailer Claudius at sailer-online.de
Sat Jun 28 19:59:58 CDT 2003


Am Samstag, 28.06.03, um 19:48 Uhr (Europe/Berlin) schrieb Stephan 
Huber:

>> Given two students, I want to find all teachers that have both 
>> students
>> in a class.
>
> Ah ok, I understand. My solution was: find all teachers which have 
> student 1 or student 2 in their class.
>
> Sorry, I don't know a solution, in my program I do the query like 
> above and build the join by myself. I'm also interested in a correct 
> solution with SQL.

SELECT t1.field1, t1.field2, t2.field3
FROM table1 t1, table2 t2
WHERE t1.RecID=t2.Teacher
AND (t2.student=1 OR t2.student=2)

This is an example and it should work, but the relations could be not 
correct. Play with it ;-))
For the correct SQL-Code I need the correct table-structures.

bye bye


Claudius



More information about the Valentina mailing list