我将此查询作为我的主要查询,我使用成员表中的所有记录,并从评论和聊天框中选择列。
SELECT members.*,
a.commenter_id,
b.user_id,
a.comcount,
b.chatcount
FROM members
LEFT JOIN (SELECT commenter_id,
Count(*) comCount
FROM comments
GROUP BY commenter_id) a
ON members.id = a.commenter_id
LEFT JOIN (SELECT user_id,
Count(*) chatCount
FROM chat_box
GROUP BY user_id) b
ON members.id = b.user_id
WHERE members.id = '290'
我想将此查询添加到上面
SELECT Count(friend_id) AS totFriend,
friend_id AS fi,
logged_user_id AS user,
friend_accepted AS fa
FROM member_friends
WHERE logged_user_id = '1'
AND friend_id = '290'
是否可以将其添加到混合中而不会导致任何错误?我自己尝试过,但我可能只是让自己陷入更深层次的问题。如果可能有人可以帮助我这样做,谢谢:)。