将多个记录合并为一行,多列[已解决] [英] Combine multiple records into one row with multiple columns [SOLVED]

查看:197
本文介绍了将多个记录合并为一行,多列[已解决]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将多个记录组合成一行,并为这些记录添加多列。非常类似于交叉表查询,但显示所有记录,而不是它们的摘要。


例如,如果表格如下:

I need to combine multiple records into one row with multiple columns for those records. Very similar to a crosstab query, but one that shows all the records, not a summary of them.

For example, if the table is like this:

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | 换行 | 行号

推荐答案

每个人每月可以获得两个以上的分数吗?有一个SQL解决方案,但分数越多,编码越难。
Can there be more than two scores per person per month? There is a SQL solution for that, but the more scores, the harder it is to code.


最多4个分数。


仅仅是一个FYI,使用Name或Month作为字段名称不是一个好主意,因为这些是Access中的保留字。 Access允许你使用它们,但它有时会导致问题。


无论如何,我们首先需要在你的表中有一个id字段。自动编号字段对此非常适合。然后我们需要创建一个querydef,在每条记录旁边放一个数字,告诉我们它是分数1,2,3还是4.我假设一个表名为tblScores。
Just an FYI, it is not a good idea to use Name or Month as field names as those are reserved words in Access. Access does permit you to use them, but it can sometimes cause problems.

Anyway, we first need to have an id field in your table. An autonumber field would be perfect for this. Then we need to create a querydef that puts a number beside each record to tell us if it is score 1, 2, 3 or 4. I''ll assume a table name of tblScores.
展开 | 选择 | Wrap | 行号


这篇关于将多个记录合并为一行,多列[已解决]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆