ORDER BY RAND() dans MySQL

Je veux utiliser ORDER BY RAND() requête mysql. Mais j'ai quelques question voulez poser.

ma table mysql 'image' comme:

id | image | width | height |
1  | 1.jpg | 640   | 480    |
2  | 2.jpg | 800   | 600    |
3  | 3.jpg | 480   | 600    |
4  | 4.jpg | 720   | 480    |
5  | 5.jpg | 600   | 800    |
6  | 6.jpg | 1024  | 768    |
7  | 7.jpg | 768   | 1024   |
8  | 8.jpg | 800   | 600    |
9  | 9.jpg | 720   | 560    |
10 | 10.jpg| 800   | 600    |

J'ai besoin de faire une requête mysql ORDER BY RAND() impression 5 images, les commandes sont:

first: width >= 720 and height >= 560 , 1 image(this may be width < height)

second: width > height, 2 images.(left the first 1 image, do the rest 9 images ORDER BY RAND())

third: width >= 640, 2 images.(left above 3 images, do the rest 7 images ORDER BY RAND())

tous les 5 images pas de répétition. Mon esprit sont confus maintenant, besoin d'une aide.

Mon esprit est confus, après la lecture de votre description..

OriginalL'auteur fish man | 2011-07-17