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: 
Not applicable

Error joinning tables

Hi everyone, I hope you can help me. I'm trying to join 3 tables. In SQL should be this way:

[Item Ledger Entry] INNER JOIN [Item] ON [Item Ledger Entry].[Item No_] =
[Item].No_ INNER JOIN [Tariff Number] ON
[Item].[Tariff No_] = [Tariff Number].[No_]
INNER JOIN [Value Entry] ON [Item Ledger Entry].[Entry No_] = [Value Entry].[Item Ledger Entry No_]


The script I've done is the following:


Intrastat:
LOAD
YEAR("Posting Date") As Año,
MONTH("Posting Date") As Mes,
"Item No_" As "Nº Producto",
DATE("Posting Date",'DD/MM/YYYY') As "Fecha",
"Document No_" As "Nº Documento",
"Country_Region Code" As "Código País",
"Specie" As "Especie",
"Variety" As "Variedad",
"Category" As "Categoría",
"Caliber" As "Calibre",
"Country_Region of Origin Code" As "Código País Origen",
"Tariff No_" As "Código Arancelario",
"Quantity" As "Cantidad",
IF("Quantity"<0,'Envío','Recepción') AS "Tipo Movimiento";
SELECT *
FROM "$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Item Ledger Entry" JOIN
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Item" ON
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Item Ledger Entry" ."Item No_" =
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Item"."No_" JOIN
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Tariff Number" ON
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Item"."Tariff No_" =
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Tariff Number"."No_";
[/Code]
Running this I have no trouble just because all tha loaded fields belong to the first table
 "Item Ledger Entry"
.

But If I include the field "Description" that belongs to the table "Tariff Number" like this:


"Quantity" As "Cantidad",
IF("Quantity"<0,'Envío','Recepción') AS "Tipo Movimiento",
"Description As "Descripción";
SELECT *
FROM "$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Item Ledger Entry" JOIN
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Item" ON
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Item Ledger Entry" ."Item No_" =
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Item"."No_" JOIN
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Tariff Number" ON
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Item"."Tariff No_" =
"$(_DBName)". "$(_DBOwner)". "$(_CompanyName)$Tariff Number"."No_";

I get an error. So the questions is where part of this script do I have to define the fields of the other tables that are part of the query?
Thanks in advance



















































































































</body>
1 Solution

Accepted Solutions
pover
Luminary Alumni
Luminary Alumni

You are missing a " in the line

"Description As "Descripción";

Even though the double quotes are unnecessary.

Do a Load * over you SQL Statement to see what columns QlikView is importing.

Regards.

View solution in original post

2 Replies
pover
Luminary Alumni
Luminary Alumni

You are missing a " in the line

"Description As "Descripción";

Even though the double quotes are unnecessary.

Do a Load * over you SQL Statement to see what columns QlikView is importing.

Regards.

Not applicable
Author

You're right Thanks a lot