Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select ex.gsm,
- ex.motivo_envio,
- ex.status,
- ex.data_ativacao,
- ex.data_importacao,
- ex.data_alteracao
- from export ex
- where ex.status = 'ANOMALIA TEMPORÁRIA'
- and exists (
- select tmp.gsm
- from export tmp
- where tmp.gsm = ex.gsm
- and tmp.motivo_envio = ex.motivo_envio
- and tmp.status = ex.status
- group by tmp.gsm, tmp.motivo_envio, tmp.status
- having count(tmp.gsm) > 1)
- and data_alteracao = (select max(data_alteracao) from export tmp
- where tmp.gsm = ex.gsm
- and tmp.motivo_envio = ex.motivo_envio
- and tmp.status = ex.status
- group by tmp.gsm, tmp.motivo_envio, tmp.status
- having count(tmp.gsm) > 1)
Add Comment
Please, Sign In to add comment