Many to many relation. How?

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Dec 6 12:42:49 CST 2004


On 12/7/04 12:05 PM, "Ralf Sander" <ralf at end-if.de> wrote:

>> * Finally, in RDBMS model, to get M : M link you must to have third
>> table.
> 
> OK, lets assume, I have 3 tables.
> t1:
> 1 John
> 2 Bob
> 
> 
> t2:
> 1 personid1 taskid1
> 2 personid1 taskid2
> 3 personid1 taskid3
> 
> t3:
> 1 task1
> 2 task2
> 3 task3
> 
> How will the select statement look here, if I want to get all tasks in
> t3, that are related to record 1 in t1?

SELECT t3.*, t1.*
FROM T3, T2, T1
WHERE 
       T3.id = T2.taskID
   AND T2.personID = T1.id


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