select top 10 * From A outer apply (select top 1 * from B where A.ID=B.ID order by A.DATETIME desc) as B
关键 处( outer apply )