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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

query works too long

Hello!

I have table CUSTOMERDOCUMENT with fields customerdocumentid, customernumber, expirydate, documenttype

I want to find max(customerdocumentid) for each customernumber and i'm using query:

SELECT customernumber, documenttype, expirydate FROM CUSTOMERDOCUMENT WHERE customerdocumentid IN (SELECT max(customerdocumentid) from customerdocument as cd where cd.customernumber=customernumber);

In table is only 100000 rows but the query works an hour or even longer.

Is it possible to make this query works shorter? Can anybody suggest anything?

Thanks!

1 Solution

Accepted Solutions
Not applicable
Author

Thats a database problem. You need an db-index on customerdocumentid and customernumber, then it should work.

Greetings Alex:)

View solution in original post

1 Reply
Not applicable
Author

Thats a database problem. You need an db-index on customerdocumentid and customernumber, then it should work.

Greetings Alex:)