Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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



Tags (1)
6 Replies
kevincase
Contributor II

Re: how to use SQL Query

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
Valued Contributor

Re: how to use SQL Query

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.

MVP
MVP

Re: how to use SQL Query

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

Regards,

jagan.

balrajahlawat
Esteemed Contributor

Re: how to use SQL Query

reddys310
Honored Contributor II

Re: how to use SQL Query

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.

Community Browser