My question is pretty straightforward, how do I select 9 random records and one defined record in the same SQL statement? All I can think of so far is this, which only returns the one partner record (the defined one) but not the other 9 random ones.
$sql2 = "SELECT * FROM table WHERE filename = '$partn' AND filename != '$x' ORDER BY RAND() LIMIT 10";
To elaborate, I need ten records to be returned, none of then should be ‘$x’, one of them should be ‘$partn’ and then 9 other random ones, they all need to be displayed in a random order.
Any help would be appreciated!:)
1 Answer