SELECT * FROM(

SELECT *,ROW_NUMBER() OVER(PARTITION BY a.claimno ORDER BY b.financiancedate DESC)  number FROM

(SELECT * FROM database1.table1 WHERE dt = "20200110")a

LEFT JOIN

(SELECT * FROM database2.table2 WHERE dt = "20200210")b

ON a.baseid = b.baseid)c

WHERE c.number = "1";

05-16 18:41