Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to use SQL Query

Hi,

Can i use the below SQL query directly while loading the data into Qlik sense. So that it will only load where the below query works and pull the necessary data from SQL database.

SELECT Customers.CustomerName, Orders.OrderID

FROM Customers

LEFT JOIN Orders

ON Customers.CustomerID=Orders.CustomerID

ORDER BY Customers.CustomerName;


Thanks



6 Replies
kevincase
Creator II
Creator II

Prasanta,

You are going to want to check out the New to Qlik Sense Videos.  They are full of useful information.  New to Qlik Sense Videos

There is a section on Data Loading & Modeling.  You can find what you are looking for there.

Basically you are going to create a connection to your SQL database.  Then you are going to connect using that connection.  You can then build your query/load statement from there.

Something like this:

LIB CONNECT TO 'MyDBConnection';

LOAD

CustomerName as [Customer Name],

OrderID as [Order ID];

SQL SELECT Customers.CustomerName, Orders.OrderID

FROM Customers

LEFT JOIN Orders

ON Customers.CustomerID=Orders.CustomerID

ORDER BY Customers.CustomerName;

Hope this helps.

paul_scotchford
Specialist
Specialist

As a tip. If you are going to load from SQL I recommend loading from a view (on the Server Db instance side).

This abstracts any complex to very complex query structures and you/your users etc don't need to be concerned with SQL syntax.

jagan
Partner
Partner

Yes you can use any valid SQL query in Qliksense/Qlikview to load the data from databases..

Regards,

jagan.

balrajahlawat
Champion
Champion

reddy-s
Master II
Master II

Hi Prasantha,

You can use a sql query like this in your script:

[data]:

load *;

SQL

SELECT Customers.CustomerName, Orders.OrderID

FROM Customers

LEFT JOIN Orders

ON Customers.CustomerID=Orders.CustomerID

ORDER BY Customers.CustomerName;


Thanks,

Sangram.