Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
solverproblems
Contributor
Contributor

How to join two tables in data loader?

I'm trying to concatenate two tables in data loader, the problem is there is a syntax error, someone can help me?

 

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

 

How it could be correctly? Thanks in advance!

Labels (2)
1 Solution

Accepted Solutions
Sazabi
Creator
Creator

My best guess is that you need a semi-colon after each of your SQL queries.

 

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;

 

View solution in original post

2 Replies
Sazabi
Creator
Creator

My best guess is that you need a semi-colon after each of your SQL queries.

 

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;

 

solverproblems
Contributor
Contributor
Author

Thanks!