用户活动或单选查询的单独表
我正在为我的客户创建一个社交网络,他们需要类似 facebook 的墙和用户最近的活动。
我有大约 8 个表,分别表示用户帐户、信息、群组、评论、页面、照片库、喜欢、分享。
在用户个人资料
中,他们需要用户在网站中的整个活动。
我可以使用单个连接查询吗?或者需要有单个表作为最近活动。
I am creating a social network for my client where they need facebook-like wall and user recent activity.
I have around 8 table says user account , info , groups , comments , page , photogallery, likes , shares.
In the user profile
, they need the entire activity of the user in the site.
Can I use a single Join Query or need to have a individual table as recentactivity.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用联合查询从不同的表中提取数据并将其存储在视图中。这是总体思路...
然后您可以使用类似
或 的连接来访问它
You could have a union query to pull data from the different tables and store in a view. Here's the general idea...
Then you could access it with something like
or with a join
您可以考虑创建一个
log
或activity
表来包含其最近活动的记录。这样您只需要一个查询。您将根据活动类型连接其他表。You might consider creating a
log
oractivity
table that would contain the record of their recent activity. This way you only need a single query. You would join the other tables based on the activity type.