select top 1 谈话内容 from table where 谈话内容 is not null and 公司名 in (select 公司名 from table where 谈话内容is null and datediff(dd,记录时间,getdate())=0) order by 记录时间 desc

解决方案 »

  1.   

    select 谈话内容
    from 视图 t
    where (select count(1) 
              from 视图 
                  where 公司名=t.公司名 
                        and 记录时间>t.记录时间)=1
          and
          公司名 in (
                      select 公司名
                         from 视图
                            where datediff(day,
                                           记录时间,
                                           getdate())=0
                                  and 谈话内容 is null)