Welcome... it would help if you provided DDL and sample data and what you expect to see as a result. There's a link to a posting guide somewhere, one of these days I'll add it to my cool sig.
Based on what you've said here's a sample "sample" and "DDL" of what you can provide to help us help you.
declare @BenchTest as table(ID int Identity(1,1), PartNumber int
, PartName varchar(10), TestDate datetime default getdate());
insert into @BenchTest(PartNumber, PartName)
values(1,'A'),(2,'B'),(3,'C'),(4,'D'),(1,'A'),(2,'B'),(3,'C')
,(4,'D'),(1,'A'),(2,'B'),(3,'C'),(4,'D'),(1,'A'),(2,'B')
select ID
, PartNumber
, PartName
, ROW_NUMBER()Over(Partition by PartNumber Order by (Select Null)) CycleNum
, count(*)Over(Partition by PartNumber) TotalCycle
, TestDate
from @BenchTest
order by PartNumber
---------------------------------------------------------------
Mike Hahn - MCSomething someday:-)
Right way to ask for help!!
http://www.sqlservercentral.com/articles/Best+Practices/61537/
I post so I can see my avatar :hehe:
I want a personal webpage 😎
I want to win the lotto 😀
I want a gf like Tiffa :w00t: Oh wait I'm married!:-D