Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Group By

Hola a todos,

Estoy intentando hacer una inner Join entre dos tablas y agrupar después el resultado:

Usuario:

LOAD Id as IDUsuario__c,

          Username;

SQL SELECT Id,

          Username,

FROM User;

Inner Join (Usuario)

  

Comentario:

LOAD CreatedById as IDUsuario__c,

          Count(Id) as Num;

SQL SELECT CreatedById,

          Id

FROM UserFeed

Group By CreatedById;

Me dice que agrupe también por el Id de la tabla Comentario, pero si pongo Group By CreatedById,Id tampoco funciona. No sé porqué no me salen datos.

Podéis ayudarme?

Gracias

César

12 Replies
Gysbert_Wassenaar

Comentario:

LOAD CreatedById as IDUsuario__c,

          Num;

SQL SELECT

          Id,

          Count(Id) as Num

FROM UserFeed

Group By Id;


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

Your answer don't work. The error says:

ERROR at Row:3:Column:20

unexpected token: as

Thanks,

César

Gysbert_Wassenaar

Maybe like this:

Comentario:

LOAD CreatedById as IDUsuario__c,

          Num;

SQL SELECT

          CreatedById,

          Count(Id) as Num

FROM UserFeed

Group By CreatedById;

It's not entirely clear to me if you have a CreatedById and an Id field or both in your UserFeed table.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi,

I have both in the table. The CreatedById field is the one that show who has created a comment. And I want to use the Id field to count how many comments has been posted by each person.

The same error still appears.

Thanks

Gysbert_Wassenaar

Hmm, your database doesn't understand the as keyword? That's a bit weird. 

Comentario:

LOAD CreatedById as IDUsuario__c,

          Num;

SQL SELECT

          CreatedById,

          Count(Id) Num

FROM UserFeed

Group By CreatedById;


talk is cheap, supply exceeds demand
Not applicable
Author

But in the rest of the script understands

Not applicable
Author

It could be because I'm connected to Salesforce?

smqlikview
Contributor II
Contributor II

Remove SQL from "SQL SELECT" and try.

smqlikview
Contributor II
Contributor II

Remove SQL from "SQL SELECT" and try.