Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jarrad_murray
Contributor III
Contributor III

Group by and Union in SQL load statement

Hi All,

Sorry if I am posting this in the wrong place.

I am trying to load two sets of data using SQL into a Qlik dashboard and seem to be having some difficulties. 


I have loaded the first data set using the following syntax


Qlik Table 1:

SQL

Select

     ,Column 1

     ,Column 2

     ,Count(*) as 'Column 3

from

     Table 1

Group by

     ,Column 1

     ,Column 2

UNION ALL

Select

     ,Column 1

     ,Column 2

     ,Count(*) as 'Column 3

from

     Table 2

Group by

     ,Column 1

     ,Column 2

;


This works fine and creates a table in Qlik as expected.  Performing the same action for the second table causes Qlik to just ignore the load statement and not action anything.  The statement I am using is exactly the same just creating table 2 and getting the source data from a different set of tables.

I have run the query code independently in SQL and the query works fine.  Confusingly, I can get the table to create itself by removing the group by aspect and running the SQL separately i.e.

Qlik Table 2:

SQL

Select

     ,Column 1

     ,Column 2

     ,1 as 'Column 3

from

     Table 3

;

Qlik Table 2:

SQL

Select

     ,Column 1

     ,Column 2

     ,1 as 'Column 3

from

     Table 4

;


Does anyone have any idea as to what might be going on here and how I can revert my SQL query back to a group and union as I am dealing with hundreds of thousands of rows of data and am going to make the Qlik application massive by the time I have finished.

12 Replies
jarrad_murray
Contributor III
Contributor III
Author

Wouldn't the issue of the connection affect the first query too not just the second?

sunny_talwar

I don't understand ODBC or OLE DB connections well enough to answer this, but I have seen some weird things happening using OLE DB connections. That is why I suggested trying out the ODBC connection to see if that resolves your issue.

Note: I don't know if it will solve your issue or not, but I think its worth giving a shot

jarrad_murray
Contributor III
Contributor III
Author

I'm not managing to get an ODBC connection working.  Will continue to try and let you know the outcome.  Thank you for your help so far.