Qlik Sense Syntax in Data Loader Script

邮差的信 提交于 2020-04-30 08:49:18

问题


How it would be this query in Qlik Sense syntax in data loader script?

TABLA_UTIL:
SQL
SELECT "PERIODO", SUM(DEUDAFINAL) as "DEUDAFINAL"
FROM "DL_RG_ANALYTICS"."SH_PROVISION" PRO WHERE ORG='628'
GROUP BY PERIODO

concatenate

SQL
SELECT OL.PERIODO, SUM(ABIERTA/1000000)+ DEUDA/1000000 
FROM "DL_RG_ANALYTICS"."SH_OTRAS_LINEAS" OL LEFT JOIN SH_SALDO_NO_IDEN_RUT PRO ON(OL.PERIODO=PRO.PERIODO)
WHERE ((ol.TIPO_DEUDA='TRASPASO' AND ol.DEFINICION='SALDO' ) 
OR (ol.TIPO_DEUDA='SAE' AND ol.DEFINICION='SALDO' )
OR  (ol.TIPO_DEUDA='REPACTACIONES' AND ol.DEFINICION='SALDO')
OR (ol.TIPO_DEUDA='RENEGOCIADO' AND ol.DEFINICION='SALDO' )
OR (ol.TIPO_DEUDA='AVANCE_EFECTIVO' AND ol.DEFINICION='SALDO' ))
AND PRO.TipoTarjeta='ABIERTA'
GROUP BY OL.PERIODO, PRO.DEUDA

Any help is welcome, thanks.


回答1:


Hy,

that's easy, so cheer up. If all field names in each table are identical, Qlik Sense will set this to one immediately after the other. To make it unambiguous:

concatenate(table_name)

is a good idea.

Look at this:

  • qlik script guide concatenate

Here's your example:

LIB CONNECT TO 'your_database';

TABLA_UTIL:
  Load *;
  SQL
  SELECT
  "PERIODO",
  SUM(DEUDAFINAL) as "DEUDAFINAL"
  FROM
  "DL_RG_ANALYTICS"."SH_PROVISION" PRO WHERE ORG='628'
  GROUP BY PERIODO;

LIB CONNECT TO 'your_second_database';  // where necessary

concatenate(TABLA_UTIL)  //all field names must be the same

  Load *;
  SQL
  SELECT
   OL.PERIODO as "PERIODO",
   SUM(ABIERTA/1000000)+ DEUDA/1000000 as "DEUDAFINAL"
   FROM
   "DL_RG_ANALYTICS"."SH_OTRAS_LINEAS" OL LEFT JOIN SH_SALDO_NO_IDEN_RUT PRO ON(OL.PERIODO=PRO.PERIODO)
  WHERE ((ol.TIPO_DEUDA='TRASPASO' AND ol.DEFINICION='SALDO' ) 
  OR (ol.TIPO_DEUDA='SAE' AND ol.DEFINICION='SALDO' )
  OR  (ol.TIPO_DEUDA='REPACTACIONES' AND ol.DEFINICION='SALDO')
  OR (ol.TIPO_DEUDA='RENEGOCIADO' AND ol.DEFINICION='SALDO' )
  OR (ol.TIPO_DEUDA='AVANCE_EFECTIVO' AND ol.DEFINICION='SALDO' ))
  AND PRO.TipoTarjeta='ABIERTA'
  GROUP BY OL.PERIODO, PRO.DEUDA;
//done


来源:https://stackoverflow.com/questions/60748086/qlik-sense-syntax-in-data-loader-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!