【发布时间】:2014-05-13 14:00:26
【问题描述】:
我正在使用 MS Access 2010。
我正在尝试通过连接同一张表的不同部分来创建一个包含三列的表
数据集是
ID Date Job Title Count of ID
-- --------- ------------------------------------------------------ -----------
1 13-May-14 Security Guards 15
2 13-May-14 Interpreters and Translators 22
3 13-May-14 Laborers and Freight, Stock, and Material Movers, Hand 1
4 13-May-14 Maintenance and Repair Workers, General 23
5 13-May-14 Protective Service Workers, All Other 54
6 13-May-14 Logisticians 65
7 02-Apr-14 Security Guards 88
8 02-Apr-14 Interpreters and Translators 22
9 02-Apr-14 Laborers and Freight, Stock, and Material Movers, Hand 44
10 02-Apr-14 Maintenance and Repair Workers, General 77
11 02-Apr-14 Protective Service Workers, All Other 66
12 02-Apr-14 Logisticians 8
查询是
SELECT ctrjob.[Job Title], ctrjob.[Count of ID],
(Select ctrjob.[Count of ID] from ctrjob
where ctrjob.[Job Title] = ctrjob.[Job Title] and ctrjob.[Date] = #4/2/2014#)
FROM ctrjob where [ctrjob].[Date] = #5/13/2014# ;
我希望我完成的表格创建一个表格,将 2014 年 5 月 13 日每个职位中的承包商数量放在 2014 年 4 月 2 日的数字旁边。目标是比较工人数量的变化。
但我不断收到一条错误消息
子查询最多可以返回一条记录
但我想要的只是让它从另一个日期返回一条相应的记录。每次执行时,它只应在 2014 年 4 月 2 日返回作业类别 X 中的数字。
我不想使用转换/交叉表,因为完整数据集的日期太多,我想使用表单来切换最后的日期。职称列表在所有日期都是相同的。我正在使用 MS Access 2010。
【问题讨论】: