We are having problems displaying random results from our database.
THE WANTED OUTCOME:
We need to distinctivly randomly retrieve 3 results from our table.
THE CODE:
PHP Code:
$get_ads = $mysqli->query("SELECT DISTINCT advertisers_id, id, image, pointurl, impressions, killimpressions, killdate FROM banners GROUP BY advertisers_id ORDER BY rand() LIMIT 3") or die($mysqli->error);
THE PROBLEM:
The query is selecting the top 3 distinct results ... then randomizing them. We need the opposite. We need to select 3 random rows then limit them by 3.
MySQL Version 4.1
Please help! Thanks!!