我写出来了
大家 看下   
select max(ts) as maxtime,t.name ,t.namecode  from table1  t 
where exists(Select * from cr_table1    where name = t.name and namecode  = t.namecode  )
 group by ts,t.name ,t.namecode  ;