MS Access Convert 将行转换为列

发布于 2025-01-04 19:49:50 字数 1037 浏览 2 评论 0原文

我正在 MS Access 2007 中为飞行模拟器开发数据库,​​并且需要旋转数据 - 即将行转换为列。

这很难解释,所以让我展示一下我的问题是什么。

我必须开始的数据如下所示:

Waypoint Lat            Lon    previous/next  minimim-alt   airwayName
00MKK   22.528056   -156.170961    BITTA          12         R464
00MKK   22.528056   -156.170961    CKH99          12         R464
03SML   25.61       30.635278      57SML          195        L321
03SML   25.61       30.635278      AST             85        W8
03SML   25.61       30.635278      KHG             85        W8
03SML   25.61       30.635278      KUNAK          195        L321

I need the data to look like this:

Waypoint  Lat      Lon        AirwayName Previous Next    AirwayName Previous Next 
03SML    25.61     30.635278  L321       57SML    KUNAK   W8         AST      KHG
00MKK    22.52805  -156.1709  R464       BITTA    CKH99   blank      blank    blank

对于同一航路点的每个航线,我需要一个新列,旁边包含上一个和下一个字段。每个航路点可能有多个与其关联的航线(通常不超过 10 个)。上一个和下一个条目出现的顺序并不是特别重要。

根据我收集的信息,如果可能的话,这种操作可以使用多个交叉表查询来完成。

任何帮助表示赞赏。谢谢。

I'm working on a database in MS Access 2007 for a flight simulator, and I need to pivot the data - that is, convert the rows to columns.

It's difficult to explain, so let me show what my problem is.

The data I have to start with looks like this:

Waypoint Lat            Lon    previous/next  minimim-alt   airwayName
00MKK   22.528056   -156.170961    BITTA          12         R464
00MKK   22.528056   -156.170961    CKH99          12         R464
03SML   25.61       30.635278      57SML          195        L321
03SML   25.61       30.635278      AST             85        W8
03SML   25.61       30.635278      KHG             85        W8
03SML   25.61       30.635278      KUNAK          195        L321

I need the data to look like this:

Waypoint  Lat      Lon        AirwayName Previous Next    AirwayName Previous Next 
03SML    25.61     30.635278  L321       57SML    KUNAK   W8         AST      KHG
00MKK    22.52805  -156.1709  R464       BITTA    CKH99   blank      blank    blank

For every airway the same waypoint has, I need a new column with the previous and next fields next to it. Each waypoint may have several airways associated with it(usually not more than 10). The order in which the previous and next entries appear is not especially important.

From what I've gathered, if this is even possible, this kind of operation can be done using multiple crosstab queries.

Any help is appreciated. Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

往日情怀 2025-01-11 19:49:50

我认为你需要VBA。您可以创建按航点排序的记录集,然后继续添加到分隔字符串,直到下一个航点。这样,您最终将得到可以保存为 CSV 的内容。或者,如果它是一次性的并且没有太多行,您可以考虑将整个批次导入 Excel 并在那里进行工作。

I reckon you need VBA. You can create a recordset ordered by Waypoint and just keep adding to a delimited string until the next waypoint. This way, you will end up with something that can be saved as a CSV. Alternatively, if it is a once off and there are not too many rows, you might consider importing the whole lot into Excel and doing the work there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文