SQL Select duplicate rows with specific values

SQL Select duplicate rows with specific values

I have a table (JobLog) that contains data on products. I want to be able to check if some fields may have been resubmitted and entered twice but possibly have been processed before.

I have a table (JobLog) that contains data on products. I want to be able to check if some fields may have been resubmitted and entered twice but possibly have been processed before.

My code is as follows:

SELECT A.ProductName, A.ProductCode, A.AmtHeld, A.Disposition
FROM 
    JobLog AS A 
    INNER JOIN (
        SELECT ProductCode, AmtHeld
        FROM JobLog GROUP BY ProductCode, AmtHeld 
        HAVING COUNT(*) > 1
    ) AS B 
        ON (A.ProductCode = B.ProductCode) 
        AND (A.AmtHeld = B.AmtHeld) 

And it outputs:

|ProductName | AmtHeld | ProductCode | Disposition|
|------------|---------|-------------|------------|
| chocolate  | 123     | 500         | P          |
|------------|---------|-------------|------------|
| chocolate  | 123     | 500         | C          |
|------------|---------|-------------|------------|
| vanilla    | 355     | A30         | C          |
|------------|---------|-------------|------------|
| vanilla    | 355     | A30         | C          |
|------------|---------|-------------|------------|

Is there any way to have an additional parameter of where it would only output rows that have Disposition = P as part of the row? As in, I'd only want the output of the two chocolate products since one of them has a disposition of P but not the two vanilla since they both have a disposition of C (there is no P).

|ProductName | AmtHeld | ProductCode | Disposition|
|------------|---------|-------------|------------|
| chocolate  | 123     | 500         | P          |
|------------|---------|-------------|------------|
| chocolate  | 123     | 500         | C          |
|------------|---------|-------------|------------|

Thanks in advance!

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

What are the differences between Standard SQL and Transact-SQL?

In this article, we'll explain syntax differences between standard SQL and the Transact-SQL language dedicated to interacting with the SQL

SQL Full Course - SQL Tutorial For Beginners - MySQL Essentials - SQL Training

This SQL Full Course video will cover all the topics of SQL starting from scratch. This video is great for beginners who want to learn SQL and for advanced people to brush up their skills.