Sql 两个表left join 查左表最时间最大的一条记录显示

http://bbs.csdn.net/topics/350135010

参考

select * 
from a aa left join
b bb on aa.id=bb.cid and bb.adddate=(select max(adddate) from b where cid=bb.cid)

自己写

Left  join rechargeSheet  rs on rs.PaymentCode=o.order_code  and rs.CreationTime=(select  MAX(CreationTime) from rechargeSheet where  PaymentCode=rs.PaymentCode)

原文地址:https://www.cnblogs.com/LuoEast/p/7840298.html