select * from 表 tem where code=(select top 1 code from 表 where id=tem.di order [date] desc)