Sebastian,

I don't think we completely understand your question....or 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 them (example: fruits_animals) in a 
many-to-many relationship.

Is your situation:
A) You want to return 100 un-duplicated random combinations of the 
objects, regardless of if they have an entry in the relationship table? 
- OR -
B) You want a list of 100 un-duplicated random rows from the relationship 
table?
- OR - 
C) Each time you run your query containing "ORDER BY RAND()" , you get the 
exact same set of records back?

Yours,
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine


"Gerske, Sebastian" <[EMAIL PROTECTED]> wrote on 07/20/2004 06:18:11 AM:

> 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:
> >
> > id,   name
> > 1    banana
> > 2    apple
> > 3    strawberry
> >
> > fruits_animals
> >
> > id,   id_fruits,   id_animals
> > 1    1               2
> > 2    1               3
> > 3    3               1
> > 4    2               4
> >
> > animals
> >
> > id,   name
> > 1    cat
> > 2   dog
> > 3   mouse
> > 4   elephant
> >
> >
> > My problem is that if i join the tables and order them by rand i 
always
> get
> > one result something like:
> > strawberry, cat (fruit id = 3, animal id = 1 )
> > or
> > banana, dog (fruit id = 1, animal id = 2)
> > but never
> > banana, mouse( fruit id = 1, animal id = 3 )
> >
> > and need to select 100 different relations without redundancies hows 
that
> > possible ?
> >
> > regards sebastian gerske
> >
> >
> 
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> 

Reply via email to