我想用order by语句提供我的top结果。
$sql_ins = "select user_first_name, user_last_name, user_id from user
INNER JOIN xyz on user_id=s_id
where (s_id='".$_SESSION['user']."' OR r_id='".$_SESSION['user']."')
AND user_id!='".$_SESSION['user']."' group by user_id
UNION
SELECT user_first_name, user_last_name, user_id from user
INNER JOIN xyz on user_id=r_id
WHERE (r_id='".$_SESSION['user']."' OR s_id='".$_SESSION['user']."')
AND user_id!='".$_SESSION['user']."'
GROUP BY user_id";
我想按order by id desc获取输出,但输出是一个错误。
1条答案
按热度按时间xsuvu9jc1#
使用这个查询它对我有用。。。。