title: sql repeating question
body: <p>Got exactly the same question as i asked before: <a href="https://stackoverflow.com/questions/6266418/sql-take-one-out-from-the-list">sql take one out from the list</a> :) but i cant integrate the </p>
  
  <p><code>CPA.WANT_EMAIL = 1</code> </p>
  
  <p>instead of </p>
  
  <p><code>AND CPA.PARTNER_ID = CCD.PARTNER_ID AND CCD.SITE_DOMAIN = 'www.projedepo.com')</code></p>
  
  <p>i mean want_email is also from <code>COMPANY_PARTNER CPA</code>everything is the same, except, site_domain is needed to be exactly the same as www.projedepo.com but for want_email, i need just the negative, 0 or positive 1, the formats of values are different.</p>
  
  <p>how do i do it? thx for help everyone!</p>
  
  <p>Here is the code for now:</p>
  
  <pre><code>&lt;cfquery name="GET_POT_COMPANY" datasource="#DSN#"&gt;
      SELECT
          C.COMPANY_ID,
          C.MEMBER_CODE,
          C.FULLNAME,
          C.PARTNER_ID,
          C.RECORD_DATE,
          CC.COMPANYCAT
            &lt;cfif isdefined('attributes.report_sort2')
              and attributes.report_sort2 is 1&gt;
              , 'www.projedepo.com' AS SITE_DOMAIN
            &lt;/cfif&gt;
      FROM 
          COMPANY C, 
          COMPANY_CAT CC
      WHERE
            C.COMPANYCAT_ID = #attributes.comp_cat# 
        AND CC.COMPANYCAT_ID = C.COMPANYCAT_ID
          &lt;cfif isdefined('attributes.report_sort2')
            and attributes.report_sort2 is 1&gt;
            AND EXISTS
              ( SELECT *
                FROM
                  COMPANY_CONSUMER_DOMAINS CCD,
                  COMPANY_PARTNER CPA
                WHERE C.COMPANY_ID = CPA.COMPANY_ID
                  AND CPA.PARTNER_ID = CCD.PARTNER_ID
                  AND CCD.SITE_DOMAIN = 'www.projedepo.com'
              )
          &lt;/cfif&gt;
      ORDER BY 
          C.RECORD_DATE DESC
  &lt;/cfquery&gt;
  </code></pre>
  
  <p>this is the previous example, the working one, all i need is to change the <code>AND CPA.PARTNER_ID = CCD.PARTNER_ID AND CCD.SITE_DOMAIN = 'www.projedepo.com'</code></p>
  
  <p>to <code>CPA.WANT_EMAIL = 1</code></p>