Many to many relation. How?

Juergen Schreck lists at innernine.com
Mon Dec 6 07:51:56 CST 2004


On Dec 7, 2004, at 4:53 AM, Ralf Sander wrote:

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

It's early, but how about so:

SELECT *
FROM   t3, t1, t2
WHERE  t2.personid == 1
AND    t3.id == t2.taskid

HTH,
Juergen

--
---------------------------------------------------------------------
Innernine                                    http://www.innernine.com
Custom Software Solutions                                262.781.5295
---------------------------------------------------------------------



More information about the Valentina mailing list