views:

30

answers:

1

Hi I have two different tables containing lot of images.

I need to display 50 random images from both tables. How can I do like that.

How can I select random images using MySQL?

or

if I select 100 images from both tables. How can I choose 50 random images from that array using php?

any body knows the solution please help me.

+2  A: 

You can do the following:

SELECT * FROM `some_table` ORDER BY RAND() LIMIT 50

You can adjust that approach to fit your exact needs (i.e. LIMIT 25 on both queries and joining the result in PHP).

elusive
For two tables you may use UNION.
Kel
Thanks for your valuable comments :-)
learner