Sql server 左连接查询最大记录

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);

 

posted @ 2021-08-10 20:29  LuoCore  阅读(218)  评论(0编辑  收藏  举报