Trying to use NOT EXISTS to check a row exists but fail
<p>I want to get if the 'product' is TV and the mark is good, then I want the color is red. However, I also want to get every row of TV mark is not 'good' regardless of the color.  So I use NOT EXISTS() to check if the TV row' mark has no 'good', but it fail. did i use the NOT EXISTS() wrong or any other way? The expected output is get all product tv with color red with mark good, but also any product TV mark is not 'good' regardles</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
$sql = $wpdb-&gt;get_var( $wpdb-&gt;prepare("
SELECT product FROM table WHERE product='tv' AND amount IN (%s, %s, %s) 
AND mark='good' AND color=%s 
 OR NOT EXISTS 
(SELECT product FROM talble WHERE product='tv' 
AND amount IN (%s, %s, %s) AND mark = 'good') GROUP BY product 
",$amount1,$amount2,$amount3,$color,$amount1,$amount2,$amount3));
/*
product    amount      color          mark
 tv         4        red           good
 tv         5         yellow        bad
 tv         4          black         OK
 tv         6       black         bad  
 tv         4       yellow        good
 radio      5       yellow        good
 radio      6          yellow        good
*/

?&gt;</code></pre>
</div>
</div>
</p>