Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Rahell39
Contributor III
Contributor III

MySQL statement in Load (Qlik Sense)

Dear All,

I am rather new to Qlik ETL zone, and I would require your assistance in loading in Qlik Sense scrip, a query which I wrote in MySQL, any suggestions?

"SELECT
c.id AS id,
c.account_id AS vendor,
c.name AS name,
parent.id AS subcategory_id,
grandparent.id AS category_id,
greatgrandparent.id AS supracategory_id,
parent.name AS subcategory_name,
grandparent.name AS category_name,
greatgrandparent.name AS supracateogry_name

FROM food_menu_tags AS c
LEFT JOIN food_menu_tags AS parent
ON c.parent_id = parent.id
LEFT JOIN food_menu_tags AS grandparent
ON parent.parent_id = grandparent.id
LEFT JOIN food_menu_tags AS greatgrandparent
ON grandparent.parent_id = greatgrandparent.id

 

Thx,

Sorin
"

Labels (1)
1 Reply
jmartineze
Partner - Creator
Partner - Creator

Hi,

First of all, you need create the data connection. 

Your load script shoud be like....

 

LIB CONNECT TO 'name';

TABLE1:
SELECT * FROM bbdd.table;

etc.. and after make joins, or 

 

LIB CONNECT TO 'name';

TABLE1:

LOAD c1, c2, c3;
SELECT * FROM bbdd.table where condition;

inner/left join

LOAD d1,d2 as c2,d3

SELECT * FROM bbdd.table where condition;

 

you don´t need statements like  ON c.parent_id = parent.id, it´s enough if there fields with the same name.