Hi,Select query in code is returning desired results.can i get it without using #number table.create table #temp (a char(10),b char(10))insert into #temp values('TEST1','TEST1')insert into #temp values('TEST1','TEST1')insert into #temp values('TEST1','TEST1')insert into #temp values('TEST2','TEST2')insert into #temp values('TEST2','TEST2')insert into #temp values('RAJ','RAJ')insert into #temp values('RAJ','RAJ')insert into #temp values('RAJ','RAJ')insert into #temp values('RAJ','RAJ')insert into #temp values('RAJ','RAJ')create table #number (n int)insert into #number values (1)insert into #number values (2)insert into #number values (3)insert into #number values (4)insert into #number values (5)insert into #number values (6)select t.a,t.b, #number.nfrom (select a,b,count(*) c from #temp group by a,b) tcross join #numberwhere #number.n<=t.cdrop table #tempdrop table #number
Thanksmk_garg