SELECT *
FROM `history`
WHERE `site_id` = '1'
AND `user_id` = '1'
ORDER BY `date` DESC
LIMIT 0 , 20
在history
表中是字段child_user_id
。我需要检查child_users
表中是否存在此 id,如果存在 - 将其替换为child_user_name
from child_users
,否则user_name
从users
表中设置 whereuser_id = '1'