SELECT * FROM Billcode_in a LEFT JOIN Billcode_place b ON a.billcode=b.billcode AND b.id=(SELECT MAX(id) FROM Billcode_place WHERE billcode=b.billcode AND place_wavehouse_id=5);
Sql server 左连接查询最大记录
原文:https://www.cnblogs.com/LuoCore/p/15125699.html