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: 
qvqfqlik
Creator
Creator

Error when using group by.

FROM

  abcd.QVD (qvd)

  WHERE EXISTS (Flag)

  AND [field1] <> 'XYZ'

  AND field2 <> 'PQRS'

Group by

cal_key,

mat_key,

    cus_key,

    sdo,

    Flag

  ;

I included all fields in the group by.

without group by it works fine. But When I use group by along with two AND conditions, its failing to run.

Also, It works fine when I use "group by"  and remove the  two 'AND" conditions.

I am using aggregations in the load statement.

Please help.

Message was edited by: Prithvi K

5 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

An added requirement for using the GROUP BY clause is that all fields listed in the GROUP BY clause should also appear - without aggregation functions - in the column list of the LOAD statement. Otherwise the group by makes no sense: should it create a single output record because there are no differing characteristics in the group by result set? Or should it create multiple records that have no identifying field values of their own?

Best,

Peter

johnw
Champion III
Champion III

Nothing about the portion of the load statement you show is jumping out at me, but clearly that's not your actual load statement. It would be much easier to debug your code if you showed us the actual code that has the bug. Also, what does "failing to run" mean? You get an error? What error?

swuehl
MVP
MVP

Any reason why you don't show the LOAD statement with the fields you are loading?

Do field1 and field2 exist in your QVD?

Do cal_key, mat_key, cus_key, sdo and Flag exist in your QVD?

What error message do you get?

qvqfqlik
Creator
Creator
Author

yes the field1 and field2 exist in QVD

qvqfqlik
Creator
Creator
Author

somehow its running fine now. Thanks very much for looking into this. Really appreciate your responses.

However, my posts doesn't get posted unless the moderator approves it. Not sure why this happens.