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

Amit GuptaRank #190 · 12.8K reputationPosted Jan 1, 2021, 3:36 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Dec 31, 2020, 8:09 PM EST
ahmed elbarbaryRank #1,060 · 1.8K reputationPosted Dec 31, 2020, 8:15 PM EST
Ajay GohilRank #2,370 · 599 reputationPosted Dec 31, 2020, 10:01 PM EST
Jignesh KumarRank #91 · 22.9K reputationPosted Dec 31, 2020, 10:55 PM EST
Amit GuptaRank #190 · 12.8K reputationPosted Jan 1, 2021, 1:36 AM EST
ahmed elbarbaryRank #1,060 · 1.8K reputationPosted Jan 1, 2021, 2:01 AM EST