select rownum from ( SELECT ROW_NUMBER() over (order by CreateTime asc) as rownum,CompanyId,SourceType FROM dbo.t_BaiduIncludedRecord where Status=0 ) t where t.CompanyId=1 and t.SourceType=2