I'm using spring batch to read from table and write the data to another table and I'm using spring writer for the insertion part. My problem is:
I'm getting data from a table that looks like the following:
cust type date
==== ===== ====
1 P 1985
1 P 1980
1 P 1970
2 P 1984
and I'm trying to insert these data to another table by running a query that select distinct( cust , type)
from the above table to get the following result:
cust type date
==== ===== ====
1 P 1985
2 P 1984
so basically what I want to do is to get the distinct set of cust and type
and if there are multiple records for this cust. type
set then I get the max(date)
.
Is there anyway to do so in using query? or any recommendation for an efficient approach?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire