I am trying to use Max function to get the record with latest dates but it does not give desired results as it also gives data with old dates.Below is output of dataframe OA_Output:
 Org_ID   ORG_OFFICIAL_NORM_NAME  ORG_IMMEDIATE_PARENT_SRC   ORG_IP_SRC_MD_Date 
--------  ----------------------  ------------------------   ------------------ 
 132693   BOLLE INCORPORATED          abc.com               26-JUN-18
 122789   BEE STINGER, LLC            aa.com                12-Mar-18
 344567   CALIBER COMPANY             xyz.com               16-Feb-16
 639876   Maruti                      yy.com                23-Jun-17
I am running below R Code to get the records with latest dates:
gautam1 <-
  sqldf(
    "
    SELECT ORG_OFFICIAL_NORM_NAME,ORG_IMMEDIATE_PARENT_SRC
   ,MAX(ORG_IP_SRC_MD_DATE),ROW_ID
    FROM OA_output
    where ROW_ID = 1
    and ORG_IMMEDIATE_PARENT_SRC like '%exhibit21%'
    GROUP BY ORG_IMMEDIATE_PARENT_ORGID
    ORDER BY ORG_IMMEDIATE_PARENT_ORGID
    "    )
In The above code max function is not giving desired results.I am not sure whether there is a date format issue between Oracle and R. Any help will be appreciated Thanks Gautam
 
    