I have a few tables, I wrote a sql to join those tables and insert the result to a final table. The final table is tb(account, date), account is a primary key. The problem came from the result of the query, which would look like following:
account date
0001 09/01/2012
0001 09/02/2012
0002 09/01/2012
0003 09/03/2012
when I insert above those result records, I got Violation of PRIMARY KEY constraint error. How do I fix the query, I could get the result records like following
account date
0001 09/02/2012 (get the latest date)
0002 09/01/2012
0003 09/03/2012
Thanks.
How about
It would make a lot more sense if you were to show us the table schemas, original query, and soem example data.