Select 单号,操作ID,时间,分类=(Select Max(a.分类) From 表A as a 
            where CharIndex(a.ID,b.操作ID)>0) From 表B as b