4 Replies Latest reply: Jan 26, 2016 7:50 PM by jagan mohan rao appala RSS

    Question About Script With "Where Exists"

    Rafael Souza

      Hello Guys, concerning the use of "Where Exists" in the scripts I have a question:

       

      I have 2 tables:

       

      (A)

      LIB CONNECT TO 'DBGESTAOCP';

      LOAD NuContrato, DtContrato, 'DBGESTAOCP' AS 'indicator';

      SQL SELECT NuContrato, DtContrato

      dbo.TbContrato FROM

      WHERE DtContrato BETWEEN '20160101' AND '20160126';

       

      (B)

      LIB CONNECT TO 'DBPENDENCIA';

      LOAD NuContrato,

          CdTipoEstadoEnvelope,

          DtEntrega,

          DtRecebimento,

          DtPrimeiraFormalizacao;

      SQL SELECT NuContrato,

          CdTipoEstadoEnvelope,

          DtEntrega,

          DtRecebimento,

          DtPrimeiraFormalizacao

      FROM dbo.TbEnvelope;

       

      Question:

      I need that table B only load up data where B.NuContrato = A.Nucontrato.

      Because Table B has many records!

      How to properly use the "Where Exists " in this case ?

       

       

      Thank you!