I want to query the table below and retrieve the latest record (based on ISSUE_DATE) for each ID that way I can get the latest information. The problem is that one ID may have more than 1 records with different T_START_DATE and T_END_DATE / START_DATE and END_DATE, but of course I want to have MIN(T_START_DATE) and MAX(T_END_DATE) / MIN(START_DATE) and MAX(END_DATE). Here is a sample dataset I am working with:
ID        SA_NO ISSUE_DATE  START_DATE  END_DATE    T_START_DATE    T_END_DATE
378_1A_A_20 4   04/09/2019                           08/09/2019     31/12/2019
378_1A_A_20 3   17/07/2019                           21/07/2019     30/09/2019
378_1A_A_20 2   09/07/2019                           13/07/2019     30/09/2019
378_1A_A_20 1   26/06/2019                           30/06/2019     30/09/2019
378_1A_A_5  3   02/07/2019                           08/09/2019     31/12/2019
378_1A_A_6  4   04/09/2019                           08/09/2019     31/12/2019
378_1A_A_G  4   04/09/2019  08/09/2019  31/12/2019      
378_1A_A_G  3   17/07/2019  21/07/2019  30/09/2019      
378_1A_A_G  2   09/07/2019  13/07/2019  30/09/2019      
378_1A_A_G  1   26/06/2019  30/06/2019  30/09/2019      
378_1A_B_20 4   04/09/2019                           01/01/2019     31/10/2019
378_1A_B_20 4   04/09/2019                           01/11/2019     31/12/2019
I would expect to get the results like this:
ID        SA_NO ISSUE_DATE  START_DATE  END_DATE    T_START_DATE    T_END_DATE
378_1A_A_20 4   04/09/2019                           08/09/2019     31/12/2019
378_1A_A_5  3   02/07/2019                           08/09/2019     31/12/2019
378_1A_A_6  4   04/09/2019                           08/09/2019     31/12/2019
378_1A_A_G  4   04/09/2019  08/09/2019  31/12/2019      
378_1A_B_20 4   04/09/2019                           01/01/2019     31/12/2019
Any comments/corrections would be much appreciated, thanks!
 
     
     
    