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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load

Hello,

In the script i have next:

StartSite:

SELECT * FROM TARGETTABLE;

---------------

In the script i want a new select statement that selects all results from Startsite with e.g. group by

GroupStartSite:

SELECT ColumnA, count(*) FROM <<StartSite>> GROUP BY ColumnA

How do i define a new select statement based on source earlier select statement in script?

Thx in advance

15 Replies
johnca
Specialist
Specialist

Actually, it's confused me more. I can't seem to find an example that doesn't group all unaggregated fields in a query.

Not applicable
Author

Hi John,

please see attached, the base data has 4 dimensions and you can see different grouped up tables created from this. Each table needs the fields to aggregate by included in the group by

hope that helps

Joe

tamilarasu
Champion
Champion

Hi JoeSimmons,

Could you explain what is happening behind the script. I just want to understand Group by statement here.

Capture.PNG

Not applicable
Author

Hi Tamil,

this was me trying to show an example of entering all the underlying dimensions in the group by, still with a limited load of dimensions.

So the code will group by all 4 fields and create you a row for each aggregated entry (based on the 4). as you only have a single field in the load statement, you will see on the output multiple entries for each value in FieldA.

If however you only have the FieldA in the group by, you'll get a single row for each value.

I was just trying to show the difference in output between those two really.

Hope that helps

Joe

johnca
Specialist
Specialist

Hi Joe,

I was going to say your examples were exactly what I was saying until I looked closely at the last one. I get the first ones, but I'm still stumped why someone may want to do the last one. Thanks for confusing me more. 🙂

V/r,

John

Not applicable
Author

Hi John,

I'm not saying you would want to the last one, if you only have the one field loading you have extra rows for not much reason.

I was just trying to show what would happen if you include all the fields in the group by in that example,  just to illustrate you may not want all fields in your group by

Hope that helps

Joe