每个工人的最大日期
考虑两个表。 Worker 表具有诸如 W_ID、W_Name
之类的字段。课程表包含 C_ID、C_Name、C_Date
等字段。
一个工人可以选修多门课程,一门课程也可以由许多工人选修。因此,两个表之间存在多对多关系。打破多对多,并创建一个名为 Takes 的新表,其中包含外键 W_ID 和 C_ID。
问题是:我想找出所有工人的名单以及他们最后参加的课程。例如,如果 W_ID=1,则 C_Date 为 20/01/2010、C_Date 25/10/2010 和 C_Date 20/12/2010。
那么所需的结果是:
W_ID C_Date
1 20/12/2010
2
3
4
编辑
我想找到每个工人完成的课程的最大日期,因为工人会完成许多课程。我是商科学生,所以我不能使用 INNER JOIN 命令。可以用IN代替吗?
我在 Microsoft Access 中使用 SQL
Consider two tables. Worker table has fields like W_ID, W_Name
. Course table has fields like C_ID, C_Name, C_Date
.
A Worker can take many courses and a course can be taken by many Workers. Therefore, there is a many to many relationship between the two tables. Break the many to many, and create a new table called Takes which consists of the foreign keys W_ID and C_ID.
Here is the question: I want to find out a list of all workers and their last course taken. For example if W_ID=1 took C_Date 20/01/2010 and C_Date 25/10/2010 and C_Date 20/12/2010.
Then the Result required is:
W_ID C_Date
1 20/12/2010
2
3
4
Edit
I want to find the maximum date of the course each worker has done as workers would have done many courses. I am a business student, so I can't use INNER JOIN command. IN can be used instead?
I am using my SQL in Microsoft Access
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
或者这个:
or this: