title: oracle field combination
body: <p>I am making a query to a table, where I am interested in bringing the contract numbers that are being repeated, and for this I use partition by, and so far everything is fine. However, I require that you only bring me those contract numbers that in the &quot;CAMPO&quot; field meet a combination of values, both SMTP_ADDR and TEL_NUMBER and these values ​​are not the same in the contract numbers, as shown in the image. Record 1 and 2 should not output, and 3 and 4 is how you would expect them to output.</p>
  <p><a href="https://i.stack.imgur.com/o5fZG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o5fZG.png" alt="enter image description here" /></a></p>
  <p>my query is this:</p>
  <pre><code>with temp as
    (
    select 
       gral.contrato, 
       gral.campo,  
       count(*) over (partition by gral.contrato) as counter 
     from CAM_TBL_ALERTA_GRAL gral
         WHERE  
           FECHA_MODIFICACION &gt;'01/07/2021'
                      AND 
                      (CAMPO='SMTP_ADDR')
                      OR CAMPO='TEL_NUMBER'
      )
       select contrato,campo,counter
      from temp
          where counter &gt;= 2      
  
  
  
   
  </code></pre>