我有这样的声明:
SELECT board.*,numlikes
FROM board
LEFT JOIN (
SELECT pins.board_id, COUNT(source_user_id) AS numlikes
FROM likes
INNER JOIN pins ON pins.id = likes.pin_id
GROUP BY pins.board_id
) likes ON board.id = likes.board_id
WHERE who_can_tag=''
ORDER BY numlikes DESC
LIMIT 10
然后我可以从board
using中提取行".$info['board_name']."
。但是,我不擅长使用多个联接,除了board
andlikes
表之外,我还需要将另一个表加入到该表中。第三个表是user
并匹配到board.user_id
with user.user_id
。
然后我如何使用这些数据从中提取用户名user
?
不会在表中".$info['username']."
搜索字段吗?username
board