SHARE
TWEET

Untitled

a guest Feb 16th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select ex.gsm,
  2.            ex.motivo_envio,
  3.            ex.status,
  4.            ex.data_ativacao,
  5.            ex.data_importacao,
  6.            ex.data_alteracao
  7.     from export ex
  8.     where ex.status = 'ANOMALIA TEMPORÁRIA'
  9.     and exists (
  10.                 select tmp.gsm
  11.                 from export tmp
  12.                 where tmp.gsm = ex.gsm
  13.                 and tmp.motivo_envio = ex.motivo_envio
  14.                 and tmp.status = ex.status
  15.                 group by tmp.gsm, tmp.motivo_envio, tmp.status
  16.                 having count(tmp.gsm) > 1)
  17.    and data_alteracao = (select max(data_alteracao) from export tmp
  18.                 where tmp.gsm = ex.gsm
  19.                 and tmp.motivo_envio = ex.motivo_envio
  20.                 and tmp.status = ex.status
  21.                 group by tmp.gsm, tmp.motivo_envio, tmp.status
  22.                 having count(tmp.gsm) > 1)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top