Table structure of logs table
id | reference_id | service_name | type | data | created_on |
---|---|---|---|---|---|
504 | 7cb54c325450b4bc26 | CC_VERIFY_REGISTRATION | 0 | {{response_data}} | 2020-09-14 07:53:42 |
505 | 7cb54c325450b4bc26 | CC_VERIFY_REGISTRATION | 0 | {{response_data}} | 2020-09-15 17:13:09 |
506 | 7cb54c325450b4bc26 | MOBILE_VERIFY | 0 | {{response_data}} | 2020-09-20 7:53:42 |
This is the sample data. With this reference id ,many services logs are registered. CC_VERFIY_REGISTRATION service failed, hence 2 entries as one denotes latest entry. How do I identify last retry time of ANY API for a particular reference_id
select created_on
,service_name
from thirdparty_service_logs tsl
where reference_id ='7cb54c325450b4bc26'
group by service_name ,created_on
This gives the latest created_on for each service. But looking for latest created_on for reference_id . In this case, though the latest api call is for MOBILE_VERIFY, i'm looking for id 505's created_date column as output