• For older environments or other than T-SQL flavor, more generically would be something like (untested):

    SELECT c.Accountno,C.Company,C.Contact,C.Recid,H.lastuser,H.lastdate

    FROM contact C

    LEFT JOIN history h ON C.accountno=h.accountno

    LEFT JOIN (SELECT accountno,MAX(lastdate) AS lastdate

    FROM history

    GROUP BY accountno) mx ON h.accountno=mx.accountno

    AND h.lastdate=mx.lastdate