title: Inner query and joins
body: <p>I have written a query to get a code from table A which is not in table B for same ID. I have hardcoded the ID in the query, I want to know how to get the desired output for all the IDs not for 539 alone. Below is the query</p>
  
  <pre><code>SELECT
      a.code
  FROM
      A
  WHERE
      a.code NOT IN(
          SELECT
              b.code
          FROM
              B b
          WHERE
             b.ID='539'
          AND b.status &lt;&gt; 'D')
  AND 
       (a.id='539')
  AND 
       (a.status &lt;&gt; 'D')
  </code></pre>