Re: [GENERAL] Query m:n-Combination

2008-10-25 Thread Tomasz Myrta
Ludwig Kniprath napisal 24.10.2008 11:45: Join-table mn_2_r_id mn_2_c_id 1 1 1 2 1 3 1 4 2 1 3 2 3 5 4 3 ... (in real database this relation is an gis-relation with thousands of rivers and countries, related by

Re: [GENERAL] Query m:n-Combination

2008-10-24 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Ludwig Kniprath <[EMAIL PROTECTED]> writes: > Dear list, > I have to solve a simple Problem, explained below with some sample-Data. > A typical M:N-constellation, rivers in one table, communities in the > other table, m:n-join-informations (which river is running i

Re: [GENERAL] Query m:n-Combination

2008-10-24 Thread Sam Mason
On Fri, Oct 24, 2008 at 03:05:33PM +0200, Albe Laurenz wrote: > Ludwig Kniprath wrote: > > I want to know, which river is running through communities > > 1,2,3 *and* 4? > > You can see the solution by just looking at the data above (only > > "river_1" is running through all these countries), but

Re: [GENERAL] Query m:n-Combination

2008-10-24 Thread Thomas Markus
hi, try select r.* from rivers r join jointable j1 on r.r_id=j1.mn_2_r_id join communities c1 on j1.mn_2_c_id=c1.c_id and c1.C_Name='community_1' join jointable j2 on r.r_id=j2.mn_2_r_id join communities c2 on j2.mn_2_c_id=c2.c_id and c2.C_Name='community_2' join jointable j3 on

Re: [GENERAL] Query m:n-Combination

2008-10-24 Thread Albe Laurenz
Ludwig Kniprath wrote: > A typical M:N-constellation, rivers in one table, communities in the > other table, m:n-join-informations (which river is running in which > community) in a third table. > > Table rivers: > R_ID R_Name > 1 river_1 > 2 river_2 > 3 river_3 > 4 river_4 > 5

[GENERAL] Query m:n-Combination

2008-10-24 Thread Ludwig Kniprath
Dear list, I have to solve a simple Problem, explained below with some sample-Data. A typical M:N-constellation, rivers in one table, communities in the other table, m:n-join-informations (which river is running in which community) in a third table. Table rivers: R_ID R_Name 1 river_1 2