0 Replies Latest reply: Jan 2, 2017 2:37 PM by ednilton souza RSS

    Line with Total and Average using subquery / Linha com Total e Media usando subconsulta

    ednilton souza

      Hello good Morning. You can perform a subquery on qlik.

      Example of a subquery that made no sql wanted to redo via Qlik

       

      Olá, Bom Dia. É possível realizar uma subconsulta no qlik .

      Exemplo de uma subconsulta que fiz no sql queria refazer via Qlik

       

       

       

      no sql :

      SELECT '' AS R,

      ISNULL(P_APPARATUS,0)         AS P_APPARATUS,

      ISNULL(PAYMENTINTEREST,0)         AS PAYMENTINTEREST,

      ISNULL(INTERNACIONAL,0)  AS INTERNACIONAL,

      VALORF,

      DTVENCIMENTO ,id

       

      FROM VW_DEFPERFIL01

       

      UNION ALL

       

      SELECT

      'TOTAL' AS R,

      SUM(ISNULL(P_APPARATUS,0))         AS P_APPARATUS,

      SUM(ISNULL(PAYMENTINTEREST,0))         AS PAYMENTINTEREST,

      SUM(ISNULL(INTERNACIONAL,0))  AS INTERNACIONAL,

      SUM(VALORF) , '' AS DTVENCIMENTO , '0' AS id

       

      FROM VW_DEFPERFIL01

       

      UNION ALL

       

      SELECT

      'MEDIA' AS R,

      AVG(ISNULL(P_APPARATUS,0))         AS P_APPARATUS,

      AVG(ISNULL(PAYMENTINTEREST,0))         AS PAYMENTINTEREST,

      AVG(ISNULL(INTERNACIONAL,0))  AS INTERNACIONAL,

      AVG(VALORF), '' AS DTVENCIMENTO, '0' AS id

       

      FROM VW_DEFPERFIL01

       

      Why this subquery ??

      To put a total and a half line in my report.

       

      porque esta subconsulta??

      para colocar uma linha de total e media no meu relatório.

       

      Mensagem editada por: ednilton souza