Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
AuroraA
Contributor II
Contributor II

SQL Script Not Working in Qlik Sense

This is my script:

LIB CONNECT TO 'Mobius (company)';

 

SELECT

  TRANS.TRANSACTIONID,

  TRANS.ADDEDTS,

  TRANS.TRANSACTIONAM,

  TRANS.TRANSACTIONCD,

  TRANS.MAILPHONECD,

  TRANS.TRANSACTIONDT,

  TRANS.CASEID,

 

  FT_BANK.BANKNM,

  FT_BANK.BANKID,

 

  ACCOUNT.SYSTEMNR,

  ACCOUNT.PRINNR,

  ACCOUNT.FRAUDDT,

  ACCOUNT.CASEID,

  ACCOUNT.PIID,

 

  CASE_QUE.OPENTS,

  CASE_QUE.CLOSETS,

  CASE_QUE.REOPENTS,

  CASE_QUE.CASEID,

  CASE_QUE.PIID,

 

  CASE_SUMMARY.GROSSFRAUDAM,

  CASE_SUMMARY.NETFRAUDAM,

  CASE_SUMMARY.CASEID,

 

  ACT_LOG.ACTIVITYTS,

  ACT_LOG.TYPECD,

  ACT_LOG.TRANSACTIONID,

  ACT_LOG.CASEID,

  ACT_LOG.TRANSACTIONCD,

 

  SYSTEM_PRIN.SYSTEMNR,

  SYSTEM_PRIN.PRINNR,

  SYSTEM_PRIN.BANKID

 

FROM FT_OWNER.ACCOUNT ACCOUNT

 

LEFT JOIN FT_OWNER.SYSTEM_PRIN SYSTEM_PRIN

  ON ACCOUNT.SYSTEMNR = SYSTEM_PRIN.SYSTEMNR

  AND ACCOUNT.PRINNR = SYSTEM_PRIN.PRINNR

 

LEFT JOIN FT_OWNER.TRANS TRANS

  ON ACCOUNT.CASEID = TRANS.CASEID

 

LEFT JOIN FT_OWNER.CASE_QUE CASE_QUE

  ON ACCOUNT.CASEID = CASE_QUE.CASEID

  AND ACCOUNT.PIID = CASE_QUE.PIID

 

LEFT JOIN FT_OWNER.CASE_SUMMARY CASE_SUMMARY

  ON ACCOUNT.CASEID = CASE_SUMMARY.CASEID

 

LEFT JOIN FT_OWNER.FT_BANK FT_BANK

  ON SYSTEM_PRIN.BANKID = FT_BANK.BANKID

 

LEFT JOIN FT_OWNER.ACT_LOG ACT_LOG

  ON ACT_LOG.CASEID = TRANS.CASEID

  AND ACT_LOG.TRANSACTIONCD = TRANS.TRANSACTIONCD

  AND ACT_LOG.TRANSACTIONID = TRANS.TRANSACTIONID

 

WHERE TRANS.FRAUDTYPECD = 'F'

  AND ACT_LOG.ACTIVITYTS = TO_TIMESTAMP('2023-10-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss')

  AND (TRANS.TRANSACTIONCD = '253' OR TRANS.TRANSACTIONCD = '254')

  AND TRANS.TRANSACTIONAM > 15

  AND ACT_LOG.TYPECD = 18

  AND NOT (FT_BANK.BANKID = 1222 OR FT_BANK.BANKID = 1316) ;

I have never run an SQL script in Qlik before and was wondering if I could get help on a few things:

As my script is right now, I get the error “field names must be unique within table.”

I have tried using “as” to specify the names of fields in specific tables - I keep getting an error of “invalid identifier” when doing this. I have verified that table and field names are correct.
OR I am told something along the lines of my FROM statement being in the wrong place or an unexpected place.

Are parentheses necessary? Every time I use them, I get the error message “missing right parentheses.”

 

Can you tell me what is wrong with this script?

Labels (3)
1 Reply
David_Friend
Support
Support

@AuroraA have a look at this article written by @NadiaB :

https://community.qlik.com/t5/Official-Support-Articles/Engine-auto-table-naming-process-is-not-work...

Nadia do have anything to add on their post?