select * from tb a
join (select ClassID,FInputTime=max(FInputTime) 
from tb where FImage is not null group by ClassID)b
on a.ClassID=b.ClassID and a.FInputTime=b.FInputTime

解决方案 »

  1.   

    select top 1 产品图片 from table where 产品图片 is not null order by 插入时间 desc
      

  2.   

    select ClassID   
    , (select top 1 FImage  from tbl b where b.FInputTime >= a.FInputTime )
    ,  FInputTime
    from tbl a
      

  3.   

    select a.ClassID,a.FImage,a.FInputTime
    from tbl a
    where not exists(select 1 from tbl where ClassID=a.ClassID and FInputTime>a.FInputTime)
    and a.Fimage is not null
      

  4.   

    谢谢,mislrb  你的正确