Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Two table query doesn't work

Hi everyone,

I'm trying to perform a query with two tables because i want to load a single table with more info.

I've theese two tables, already loaded in qlik from a  db file:

Orders

Order Details

OrderID

OrderID
OrderDateProductID
ShipCityDiscount
Quantity

In script tag, I've done this:

[OrdersD]:

LOAD

  [OrderID],

  [OrderDate],

  [ShipCity],

    [ProductID],

    [Discount],

    [Quantity];

SQL SELECT `Orders`.`OrderID`

  `Orders`.`OrderDate`,

  `Orders`.`ShipCity`,

  `Order Details`.`ProductID`,

    `Order Details`.`Discount`,

    `Order Details`.`Quantity`

FROM `Orders`

WHERE `Orders`.`OrderID` = `Order Details`.`OrderID`;

But when I perform debugger, it's only says "Connector reply error: ***"

What I've done wrong?

Thank you.

1 Solution

Accepted Solutions
Not applicable
Author

ok,

i fell very stupid: i notice just now that i've forgot a comma after

SQL SELECT `Orders`.`OrderID`


now it works!


sorry

View solution in original post

11 Replies
micheledenardi
Specialist II
Specialist II

I think you have to add "Order Details" in the "From" section...

[OrdersD]: 

LOAD  

  [OrderID], 

  [OrderDate], 

  [ShipCity], 

    [ProductID], 

    [Discount], 

    [Quantity]; 

SQL SELECT `Orders`.`OrderID` 

  `Orders`.`OrderDate`, 

  `Orders`.`ShipCity`, 

  `Order Details`.`ProductID`, 

    `Order Details`.`Discount`, 

    `Order Details`.`Quantity` 

FROM `Orders` , `Order Details`

WHERE `Orders`.`OrderID` = `Order Details`.`OrderID`;

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

I've done wrong to copy my script, but there was Order Details table.

micheledenardi
Specialist II
Specialist II

Try to split your select:

OrderHeader:

SQL SELECT

  `Orders`.`OrderID`,

  `Orders`.`OrderDate`,

  `Orders`.`ShipCity`

FROM `Orders`;


left join(OrderHeader)

OrderItems:

SQL SELECT

`Order Details`.`OrderID`,

`Order Details`.`ProductID`,

    `Order Details`.`Discount`,

    `Order Details`.`Quantity`

FROM `Order Details`;


Does it work ?

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

no, it doesn't work like that.

but where are sql queries?

vishsaggi
Champion III
Champion III

May be this?

[OrdersD]:

LOAD 

  [OrderID],

  [OrderDate],

  [ShipCity],

    [ProductID],

    [Discount],

    [Quantity];

SQL SELECT `Orders`.`OrderID`

  `Orders`.`OrderDate`,

  `Orders`.`ShipCity`,

  `Order Details`.`ProductID`,

    `Order Details`.`Discount`,

    `Order Details`.`Quantity`

FROM `Orders`,

LEFT JOIN

`Order Details`

ON `Orders`.`OrderID` = `Order Details`.`OrderID`;

Not applicable
Author

nope!

I've tried to put that code into a single section, after the ones that upload table from my db file, but doesn't work.

When i perform debugger it stops at SQL SELECT ... row.

micheledenardi
Specialist II
Specialist II

try to remove all the apex `

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

nothing change

vishsaggi
Champion III
Champion III

I am sure you might be, just wondering to know if you are connecting to the database before loading using connection string.. Are you getting any results when you run only your SQL script on SQL editor?