Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
raghuvr33
Contributor III
Contributor III

Joining 2 tables

I need to join two tables getting only the latest record from second table which has multiple records matching with first table. Below is the data for the two tables and data needed for the final table.

Table A:

A1 B1 C1

Table B:

A1 B1 C1 D1

A1 B1 C1 D2

A1 B1 C1 D3

Final Table:

A1 B1 C1 D3

The data in the final table should be 1 row having four columns with the latest data  D3  in table B.

How would we go about doing this in QV?

12 Replies
raghuvr33
Contributor III
Contributor III
Author


The max is not commented in my actual script. Was trying something when i copied above

maxgro
MVP
MVP

this works

load a,b,c,d,e,

max(...), min(...)

resident ...

group by a,b,c,d,e;


this doesn't work

load a,b,c,d,e,

max(...), min(...)

resident ...

group by a,b,c;          // fields not in max, min, ..... need group by



raghuvr33
Contributor III
Contributor III
Author

This worked without giving error when i included all the fields in the group by statement.

Thanks for your help!!