SHARE
TWEET

Untitled

gkpoll Sep 30th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT COUNT(1)
  2. -- dcc.dcc_dcr_id_cpe,  dcc.dcc_dce_id_comunic, DAC.DTA_DATA,DCC.DCC_DATA_ENVIO,DCC.DCC_DATA_LEITURA,  TO_CHAR(DAC.DTA_DATA, 'yyyymmddHH24MISS')
  3.     FROM usr_sat_dtec.DTEC_COMUNICACAO_CPE DCC
  4.     JOIN usr_sat_dtec.DTEC_CIENTE_ELETRONICO DCE ON DCC.DCC_DCE_ID_COMUNIC = DCE.DCE_DCE_ID_COMUNIC AND DCC.DCC_DCR_ID_CPE = DCE.DCE_DCR_ID_CPE
  5.     JOIN usr_sat_dtec.DTEC_ACESSO_CPE DAC ON DAC.DTA_ID_CPE = DCE.DCE_DCR_ID_CPE
  6.     WHERE TO_CHAR(DCC.DCC_DATA_ENVIO, 'yyyymm') = '201909'
  7.     AND TO_CHAR(DAC.DTA_DATA, 'yyyymmddHH24MISS') >= TO_CHAR(DCC.DCC_DATA_ENVIO, 'yyyymmddHH24MISS')
  8.     AND TO_CHAR(DAC.DTA_DATA, 'yyyymmddHH24MISS') <= TO_CHAR(DCC.DCC_DATA_LEITURA, 'yyyymmddHH24MISS')
  9.     AND DCE.DCE_DCE_ID_ESTADO_CIENTE = 3
  10.     AND NOT EXISTS(
  11.                      SELECT *
  12.                      FROM usr_sat_dtec.DTEC_ACESSO_CPE DAC2
  13.                      WHERE DAC2.DTA_ID_CPE = DCE.DCE_DCR_ID_CPE
  14.                      AND TO_CHAR(DAC2.DTA_DATA, 'yyyymmddHH24MISS') >= TO_CHAR(DCC.DCC_DATA_ENVIO, 'yyyymmddHH24MISS')
  15.                      AND TO_CHAR(DAC2.DTA_DATA, 'yyyymmddHH24MISS') < TO_CHAR(DAC.DTA_DATA, 'yyyymmddHH24MISS')    )    
  16.                      
  17.     AND dcc.dcc_dcr_id_cpe=101520
  18.     ORDER BY DCC.DCC_DCE_ID_COMUNIC;
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top