Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Aggregate data of a table that is joined with another?

Hi,

I would like to try out the effect on the size of my current document of an aggregation: The Dashboard I am building is for management - plus one colleague, and only that one colleague needs the item_details.

The hurdle, however, is the fact that another masterdata table is joined via a LEFT JOIN to the masterdata table that I want to aggregate; So the script_tab where this second table connected via LEFT JOIN is loaded is to the right of the one I would have to aggregate - but the GROUP BY clause necessary for any aggregation would necessarily include a field from the second table. I am unsure now as to the sequence in which the operations in the script will be executed: Ideally, of course, the JOIN should be there first so that I can access all the fields I need for the GROUP BY clause.

Can anyone clarify this?

Thanks a lot!

Best regards,

DataNibbler

2 Replies
vikasmahajan

SELECT userid,
       awardtypeid
,
       SUM
(awardamount)
FROM   awards a
      
LEFT JOIN userinfo ui
        
ON ui.userid = a.userid
      
LEFT JOIN awardtypes
        
ON awardtypesid = a.awardtypeid
GROUP  BY userid,
          awardtypeid

Thanks

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
datanibbler
Champion
Champion
Author

Hi,

I didn't know I can use this general SQL-type of SELECT statement in QlikView? Thanks!

However, I don't need the entirety of the table I join via the LEFT JOIN, only a few fields. So I guess I will have to go via a RESIDENT LOAD.

Best regards,

DataNibbler