;with ct AS ( select count(*) ct from [Vendor Tool input] where [VDMResource] like '%bamola%' ), rcr AS ( select row_number() over(partition by [VDMResource] order by [VDMResource] desc) SrNo, * from [Vendor Tool Input] where [VDMResource] LIKE '%bamola%' and [File Name] not in (select [File Name] from VARS1B) ) select * from ct cross join rcr;
16 People are following this question.