MS Access Convert 将行转换为列
我正在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你需要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.