join question

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Jun 28 20:13:17 CDT 2003


on 6/28/03 20:01, Charles Yeomans at yeomans at desuetude.com wrote:

> On Friday, June 27, 2003, at 09:36 PM, Stephan Huber wrote:
> 
>> 
>> 
>> --On Freitag, 27. Juni 2003 18:38 Uhr -0400 Charles Yeomans
>> <yeomans at desuetude.com> wrote:
>> 
>>> Is this now possible in Valentina, and, if so, how?
>> 
>> I hope I understood your problem correcty:
>> 
>> select table1.* from table1, jointable where
>> (jointable.objectptrtotable2 = 1) or (jointable.objectptrtotable2 = 2)
>> 
>> Is this what you want?
> 
> 
> No; what I need is to to return all records of Table1 that are related
> to records in Table2 satisfying both conditions.  Let me give a more
> concrete example.  Suppose I have tables Teachers and Students, plus a
> many-many relation between them expressed in a join table.  Given two
> students, I want to find all teachers that have both students in a
> class.

Why you think that this query not works?

select table1.* 
from table1, jointable
where 
    (jointable.objectptrtotable2 = 1) or (jointable.objectptrtotable2 = 2)


May be only you need add DISTINCT.

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list