thats exactly what i wanted - the perfekt solution, now i have to thing
about performance
but thanks to Shawn Green for trying to help :>
""Arnaud"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> > i have lets say 1000 different fruits
> > and 1000 different animals
> > with
Oops, this was not correct, excuse me !
You can have duplicate id_animals with this query.
You can do it like this :
SELECT my_id_fruits, my_id_animals FROM
(SELECT id_fruits AS my_id_fruits,
(SELECT id_animals
FROM fruits_animals
WHERE id_fruits = my_id_fruits
> i have lets say 1000 different fruits
> and 1000 different animals
> with many to man relations
> now i want to extract 100 differnt fruits held by 100 different
> animals without dupes of fruit or animal
That's a nice one ! I'll give it a try :
The point is to get 100 random couples of (id_frui
brings the same result as
select
*
from
fruit,
fruit_animal,
animal
where
fruit.id = fruit_animal.id_fruit
AND
fruit_animal.id_animal = animal.id
order by rand()
or i got something wrong
the next thing is that the tables are hughe, like 3 millionen rows (growing)
thanks
OK, This is a similar solution to a problem posted last month (he was
trying to match debits to credits). Here's how it works:
Create a temporary table to match your fruits_animals table except you
want to put UNIQUE INDEXES on both columns individually. Then you run an
INSERT IGNORE to copy th
well neither a,b or c :P
i have lets say 1000 different fruits
and 1000 different animals
with many to man relations
now i want to extract 100 differnt fruits held by 100 different animals
without dupes of fruit or animal
<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Sebast
Sebastian,
I don't think we completely understand your questionor someone would
have responded long before now. Let me see if I can rephrase the
situation and maybe we can get a response.
You have two tables that contain objects (your example: fruits and
animals) and a table that relates
i think its not even possible with subqueries
""Gerske, Sebastian"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> help me please :/
>
>
> ""Gerske, Sebastian"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:[EMAIL PROTECTED]
> > Hello list,
> >
> > i still need a solutio
help me please :/
""Gerske, Sebastian"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hello list,
>
> i still need a solution for my 3 table join rand problem, im using version
> 4.1 now so subqueries are possible:
>
> explanation:
>
> i have 3 tables lets say:
>
> fruits:
>