I have two tables, say one is Sales History, the other is Key Clients.
The Sales History table looks like this(contains 500,000 rows):
Client No. Transaction Date Sales Amount
abc 1/12/2014 100
def 2/28/2014 200
hij 3/01/2014 300
abc 2/18/2014 400
abc 5/26/2014 500
xyz 7/15/2014 600
def 8/23/2014 700
hij 9/19/2014 800
And the Key Clients table looks like this:
Client No.
abc
def
xyz
Now what I want to do with R is that, based on the Key Clients table, I need to create a new table matching the earliest Sales Amount from the Sales History table. The desired results looks like this:
Client No. Earliest Sales Amount
abc 100
def 200
xyz 600