将2行数据合并为一行 [英] Merging data from 2 rows into one

查看:79
本文介绍了将2行数据合并为一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新访问,不知道如何在VBA中读取或写入,可以使用查询设计视图来创建查询..

我有2行的数据,并希望某个字段在上面的行上。

日期时间

第1行01/01/2008 05:00

第2行01/10/2008 06: 00


我需要06:00 am字段在第1行


任何帮助都会很棒

干杯

Harry

New to access, don''t know how to read or write in VBA, can use query design view to create queries..
I have data on 2 rows and would like a certain field on the row above.
Date Time
Row 1 01/10/2008 05:00
Row 2 01/10/2008 06:00

I need the 06:00am field to be on row 1

Any help would be great
Cheers
Harry

推荐答案

我假设你的数据中有两条以上的记录,否则你可以手动完成。


但是,您无法解释在什么情况下代码应该识别要添加到哪些记录的值。没有它,这个问题确实没有明确的含义。
I assume you have more than two records in your data, otherwise you could do it manually.

However, you don''t explain under what circumstances the code should recognise which values to add to which records. Without that, the question really has no defined meaning.


感谢您的回复。

有数百条记录,查询结果如下所示。(App 1)

记录按USRID和Time(Ascending)排序,因此对于每个Event_Type,应该有I和O(In和Out Time),其中Event_Type = =O。 ,Group_ID未填充。

对于每个USERID,应该有一个I。和" O"按时间戳顺序。


App1。
Thanks for the reply.
There are hundreds of records and the query results look like this.(App 1)
The records are sorted by USRID and Time (Ascending), so for every Event_Type there should be an I and O (In and Out Time), where the Event_Type is = to "O", the Group_ID is not populated.
For every USERID there should be an "I" and"O" in a timestamped order.

App1.
展开 | 选择 | Wrap < span class =codeDivider> | 行号


嗨Harry。您可以使用Access交叉表查询来完成此任务。示例SQL(可以粘贴到Access查询编辑器的SQL视图中)如下所示:

Hi Harry. You can use an Access crosstab query to accomplish this. Example SQL for this (which you can paste into the SQL view of the Access Query Editor) is as follows:

展开 | 选择 | 换行 | 行号


这篇关于将2行数据合并为一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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