DB2 SELECT EXCEPT with WHERE clause
<p>I'm trying to compare two tables in a DB2 database in z/OS using SPUFI to submit SQL queries. </p>

<p>I'm doing this by using <code>EXCEPT</code> to see the difference between two <code>SELECT</code> queries. </p>

<p>I need to filter the <code>SELECT</code> statement from the first query with a <code>WHERE</code> clause. </p>

<pre><code>SELECT KEY_FIELD_1,LOOKUP_FIELD_1  
FROM TABLE_1  
WHERE FILTER_FIELD = '1'  
EXCEPT  
SELECT KEY FIELD_2,LOOKUP_FIELD_2  
FROM TABLE_2
</code></pre>

<p>I got results back, but it also returned an error <code>-199</code> Is this because the <code>WHERE</code> clause is not present in the second <code>SELECT</code> statement? </p>

<pre><code>ERROR: ILLEGAL USE OF KEYWORD EXCEPT.  
TOKEN &lt;ERR_STMT&gt; &lt;WNG_STMT&gt; GET SQL  
SAVEPOINT HOLD FREE ASSOCIATE WAS EXPECTED
</code></pre>