question

jomara avatar image
jomara asked

Upon find duplicate also find duplicates with two conditions

I've created the following sub-query to find duplicate names select p.no, p.name, p.inactive from dbo.parts p join (select no ,count(*) as 'Count' from dbo.Parts group by no having count(*) > 1) B on P.NDC = B.NDC I would like to use the above as another sub-query where I can select all parts that have a condition where duplicates are both active (Inactive is either true or false). We have duplicates that should be inactive if duplicate but instead both are active, not sure how to find this condition
subqueryduplicate values
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
jomara avatar image
jomara answered
Sorry, didn't ask the question correctly. Need to know duplicates where we have active and inactive (the proper condition for a duplicate to inactivate one of the duplicate entries), but need to show duplicates with inactive that have QTY. Actually as I type it, I have the answer. All I have to do is the where condition looks for the inactives within the subquery for duplicates and show the QTY field as well. I'm good, disregard the question
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.