How to get duplicate on Part Id and Company Id both and have different Status ?
I work on SQL server 2012 I have issue I can't get duplicate on company id and part id
and on same time have different status
as partid 1211 and companyid 3030 repeated two times meaning two rows but with different status
pending and Done
so How to write query do that
- create table #PartsData
- (
- PartId int,
- CompanyId int,
- Status nvarchar(50)
- )
- insert into #PartsData(PartId,CompanyId,Status)
- values
- (1211,3030,'Pending'),
- (1211,3030,'Done'),
- (1599,4812,'NotFound'),
- (1599,4812,'Pending'),
- (9731,4050,'Inprogress'),
- (9731,4050,'Done'),
- (7801,4031,'Pending'),
- (7822,9815,'Pending')
- Expected result :
-
- PartId CompanyId Status
- 1211 3030 Pending
- 1211 3030 Done
- 1599 4812 NotFound
- 1599 4812 Pending
- 9731 4050 Inprogress
- 9731 4050 Done