如何制作一个mysql视图来查看多人的日程?
我有一个数据表来描述一个人的预定时间。它看起来像这样
Name | day | start_hour | end_hour
-
Tom | Monday | 8 | 12
Tom | Weekend | 16 | 20
Dick| Weekdays | 9 | 15
Sue | Sunday | 7 | 23
我怎样才能制作一个看起来像这样的视图?
Hr | M | Tu | W | Th | F | Sa | Su
...
8 | Tom | | | | | |
9 | Tom, Dick | Dick | Dick | Dick| Dick | |
...
每天每小时的视图以及该时间段内安排的人员。
I have a table of data to describe a person's scheduled time. It looks like this
Name | day | start_hour | end_hour
-
Tom | Monday | 8 | 12
Tom | Weekend | 16 | 20
Dick| Weekdays | 9 | 15
Sue | Sunday | 7 | 23
How can I make a view that looks like this?
Hr | M | Tu | W | Th | F | Sa | Su
...
8 | Tom | | | | | |
9 | Tom, Dick | Dick | Dick | Dick| Dick | |
...
A view of each hour of each day and who is scheduled during that time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您有
hours
表(1 个整数列hour
,值 0-23):If you have the
hours
table (1 integer columnhour
, values 0-23):我会尝试类似这样的查询。
start_hour start_hour 开始工作
它会告诉你有多少人可以在周一、周二的
8 2 3
I would try something like this query.
It would give you how many guys could start to work at start_hour
start_hour, monday, tuesday
8 2 3