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: 
Not applicable

Resident

Can we use group by function for resident table as below. No giving any error. But i am not sure about it. Please suggest whether it is right way or not.

For Exp:

A:

Load *

from etc.xls

B:

load *,

min(Field_name) as minfield

resident A group by Field_names;

drop table A;

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

You should not use * to selection while using group by.

You can select fields by using Aggregation functions and the fields used in group by clause.

Example:

A:

Load

ID,

PName,

Price,

Unit

From Datasource;

B:

Load

ID,

PName,

Max(Price) AS MPrice,

Max(Unit) AS MUnit

Resident A

Group By ID, PName;

I can use the ID and PName fields directly but not the Price and Unit. To use this fields i should apply some group by or aggregation functions.

View solution in original post

2 Replies
Not applicable
Author

of course you can, but be careful with the stars and grouping fields.

Your example a little bit modified without errors.

A:

Load

    ID,

    Value

Inline

[ID, Value

1, 3

1, 5

1, 7

2, 4

2, 6

2, 8];

B:

LOAD

    ID,

    Min(Value) as MinValue

Resident

    A

Group by ID;

drop table A;

CELAMBARASAN
Partner - Champion
Partner - Champion

You should not use * to selection while using group by.

You can select fields by using Aggregation functions and the fields used in group by clause.

Example:

A:

Load

ID,

PName,

Price,

Unit

From Datasource;

B:

Load

ID,

PName,

Max(Price) AS MPrice,

Max(Unit) AS MUnit

Resident A

Group By ID, PName;

I can use the ID and PName fields directly but not the Price and Unit. To use this fields i should apply some group by or aggregation functions.