To select random values you could use:

SELECT word FROM table ORDER BY rand() LIMIT 3

But the problem of not to select male and female together... 
Well, you could LIMIT your query to 4 and in your code, if one entry is one of  male 
or female, you test the others not to be female or male (respectively). For shure, you 
will always have 3 different values and you won't have male and female together 
(pityfully ;-)

Diana Soares

-----Original Message-----
From:   news on behalf of Dave Dash
Sent:   Mon 3/22/2004 3:38 PM
To:     [EMAIL PROTECTED]
Cc:     
Subject:        Selecting non opposites
I have a table of adjectives:

+--------+
| word   |
+--------+
| green  |
| ugly   |
| dark   |
| evil   |
| female |
| male   |
| drunk  |
+--------+


and I want to select three of them randomly, but I don't want female and 
male to accidentally appear together (since they are opposites).

I can't think of a query that can do that, although it seems like there 
should be something easy.

Any help out there?

Thanks ;)


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to