I would like to know how I create a limit for a query that uses UNION
in MySQL, in my case I want to set LIMIT 5
to the following query:
$friends_a = mysql_query("(SELECT * FROM users WHERE id!='$user_q[id]' AND
id='$friends_1_q[user_one_id]') UNION ALL (SELECT * FROM users WHERE
id!='$user_q[id]' AND id='$friends_1_q[user_two_id]')");
I have tried several codes that I found on the internet and I can not, what should I do?