我正在开发一个新项目。我需要mysql查询的帮助,我认为它很慢。
SELECT post_id, user_id, content, title, TIME, (
SELECT username
FROM users
WHERE id = posts.user_id
) AS username
FROM posts
WHERE user_id =1
OR user_id
IN (
SELECT DISTINCT user_to
FROM friends
WHERE user_from =1
OR user_to =1
)
ORDER BY posts.post_id DESC
LIMIT 0 , 10
谢谢你的帮助。