SELECT a, b, c FROM ".TBL_A." WHERE [statement] **`ORDER BY RAND()`** LIMIT 1
UNION
(SELECT a, b, c FROM ".TBL_A." WHERE [different statement] ORDER BY RAND() LIMIT 5)";
This query works fine without first ORDER BY RAND(), but what I need is to fetch first rec randomly by first statement and then 5 other random recs by other statement.
It seems that I can’t use two order by statements on one query…
Any thoughts?
Your approach should work. Perhaps you just need to wrap your selects in an outer select.
Note. Make sure that you have considered the difference between UNION and UNION ALL. It is a common mistake to get them mixed up.