Hello everyone, I´m starting to learn Access , SQL and a bit of VB.
My problem is the following: I have two tables, one of them contains the records for missing points on a GPS system (called the "missing" table) ... the second table, contains all the available points on GPS (called the "complete" table). I will put an example
Table: Missing
Field1:Hour
----------------
10:04
10:09
Table2: GPS
Field1:X Field2:Y Field3:Hour
----------- ------------ -----------------
10 20 10:01
11 23 10:02
12 18 10:03
14 20 10:05
13 20 10:06
14 22 10:07
16 21 10:11
What I need to do is the following: go to each record on the "Missing" table and look for the record that is closer so to assign the values of Field1 and Field 2. to it. For example, lets look at the firs registry on table "missing" which is 10:04 .... on the GPS table i can found that there are two records that are close to 10:04, 10:03 and 10:05 ... so i want to average the values of the fields X and Y, and asign that average to a new fields on the missing tables as "AvgX" and "Avg"Y ... on this case it would turn out with the values of 13 for AvgX (average of 12 and 14) and 19 for AvgY (average of 18 and 20), like this:
Table: Missing
Field1:Hour Field2:AvgX Field3:AvgY
---------------- ----------------- -----------------
10:04 13 19
I was hoping to find a way to do it with sql queries, but i cant seem to find a way to compare between records, or the only choice is VB? in the case its VB, could somebody please guide me on same basic code i can apply?
thanks in advance,
My problem is the following: I have two tables, one of them contains the records for missing points on a GPS system (called the "missing" table) ... the second table, contains all the available points on GPS (called the "complete" table). I will put an example
Table: Missing
Field1:Hour
----------------
10:04
10:09
Table2: GPS
Field1:X Field2:Y Field3:Hour
----------- ------------ -----------------
10 20 10:01
11 23 10:02
12 18 10:03
14 20 10:05
13 20 10:06
14 22 10:07
16 21 10:11
What I need to do is the following: go to each record on the "Missing" table and look for the record that is closer so to assign the values of Field1 and Field 2. to it. For example, lets look at the firs registry on table "missing" which is 10:04 .... on the GPS table i can found that there are two records that are close to 10:04, 10:03 and 10:05 ... so i want to average the values of the fields X and Y, and asign that average to a new fields on the missing tables as "AvgX" and "Avg"Y ... on this case it would turn out with the values of 13 for AvgX (average of 12 and 14) and 19 for AvgY (average of 18 and 20), like this:
Table: Missing
Field1:Hour Field2:AvgX Field3:AvgY
---------------- ----------------- -----------------
10:04 13 19
I was hoping to find a way to do it with sql queries, but i cant seem to find a way to compare between records, or the only choice is VB? in the case its VB, could somebody please guide me on same basic code i can apply?
thanks in advance,
Comment