【发布时间】:2012-05-03 12:01:03
【问题描述】:
我有这张图表
我想做的是有这个输出:
你是怎么做到这个查询的?
我有这个代码
SELECT users.firstname, users.lastname,
users.screenname, posts.post_id, posts.user_id,
posts.post, posts.upload_name,
posts.post_type, posts.date_posted
FROM website.users users
INNER JOIN website.posts posts ON (users.user_id = posts.user_id)
ORDER BY posts.pid DESC
//PROBLEM with this one is that it only views the post from all users.
//SO I added
SELECT COUNT(user_id) AS friends, SUM(user_id = ?) AS you, user_id
FROM feeds WHERE post_id = ?
//This one will give you two fields containing how many different users **feeds** the
post
请帮助大家。其实这个我只是关注Facebook的“LIKE”状态 唯一的问题是我不是这类东西的业余爱好者,所以我很高兴听到你所有的答案。我真的需要你的帮助
【问题讨论】: