I have two different tables in DB, SR table and Quotestable.
I have done left join both the table in the below query,
Select
sr.sr#, sr.sub_status, sq.quotes_status, sr.Equipment_status
from svcops_emea.s_sr sr
left join svcops_emea.s_quotes sq on sq.sr# = sr.sr#
Where s.srtype = 'Repair';
I'm getting the extracts with the duplicates because for the same SR(1-5676068874) there is two different quote_status(Quote-Cancelled, Quote-Accepted)
Now I changed my query below, I'm getting unique data based on the latest 'created' date from the Quotes table but in extract, it's missing SRs(1-8376068836) because it's not present in the Quotes table.
Select sr.sr#, sr.sub_status, sq.quotes_status, sr.Equipment_status
from svcops_emea.s_sr sr
left join svcops_emea.s_quotes sq on sq.sr# = sr.sr#
inner join
(
Select sr#, max(Created) as maxdate
from svcops_emea.s_quotes
group by sr#
) tm on sq.sr# = tm.sr# and sq.Created = tm.maxdate and sq.sr# = sr.sr#
Where s.srtype = 'Repair'
Could anyone please help me to query this condition where I can get the unique data based on a date without missing out on any SRs from SR Table?

