Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to do a SQL Join in QLIK and I keep getting a ODBC Error. I can't seem to figure it out. If anyone can see what's wrong with the code that would be great because it works in the wizard.
Cheers
Working Example in Qlik using my ODBC connection:
ODBC CONNECT TO maersk;
SQL SELECT *
FROM dynamic.tables.TblSynergi;
Working example in my SQL tool pointing to the same DB:
Select *
from dynamic.tables.TblSynergi
left outer join dynamic.tables.TblConsequence
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TblConsequence.AIE_DOCID
left outer join dynamic.tables.TblLossPotential
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TblLossPotential.AIE_DOCID
left outer join dynamic.tables.TblSynergiCause
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TblSynergiCause.AIE_DOCID
left outer join dynamic.tables.TblSpill
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TbSpill.AIE_DOCID
left outer join dynamic.tables.TblSpillReference
on dynamic.tables.TblSpill.parentid = dynamic.tables.TblSpillReference.AIE_DOCID
left outer join dynamic.tables.TblLeak
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TblLeak.AIE_DOCID
left outer join dynamic.tables.TblLeakReference
on dynamic.tables.TblLeak.parentid = dynamic.tables.TblLeakReference.AIE_DOCID
left outer join dynamic.tables.TblLossPotEvaluation
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TblLeak.AIE_DOCID
left outer join dynamic.tables.TblLossPotEvaluationConseq
on dynamic.tables.TblLossPotEvaluation.parentid = dynamic.tables.TblLossPotEvaluationConseq.AIE_DOCID;
Formatted for qlik as:
ODBC CONNECT TO maersk;
SQL Select *
from dynamic.tables.TblSynergi
left outer join dynamic.tables.TblConsequence
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TblConsequence.AIE_DOCID
left outer join dynamic.tables.TblLossPotential
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TblLossPotential.AIE_DOCID
left outer join dynamic.tables.TblSynergiCause
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TblSynergiCause.AIE_DOCID
left outer join dynamic.tables.TblSpill
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TbSpill.AIE_DOCID
left outer join dynamic.tables.TblSpillReference
on dynamic.tables.TblSpill.parentid = dynamic.tables.TblSpillReference.AIE_DOCID
left outer join dynamic.tables.TblLeak
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TblLeak.AIE_DOCID
left outer join dynamic.tables.TblLeakReference
on dynamic.tables.TblLeak.parentid = dynamic.tables.TblLeakReference.AIE_DOCID
left outer join dynamic.tables.TblLossPotEvaluation
on dynamic.tables.TblSynergi.parentid = dynamic.tables.TblLeak.AIE_DOCID
left outer join dynamic.tables.TblLossPotEvaluationConseq
on dynamic.tables.TblLossPotEvaluation.parentid = dynamic.tables.TblLossPotEvaluationConseq.AIE_DOCID;
But this doesn’t work in qlik!
I’ve tried traditional SQL syntax as well with no luck:
SELECT * from table1, table2 WHERE table1.id=table2.id
The error I get is:
ODBC READ ERROR
Hi,
Remove ODBC from the script and try again. It might work.
ODBC CONNECT TO maersk;
CONNECT TO maersk;