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: 
farolito20
Contributor III
Contributor III

Duplicate Rows

How can I compare if two tables have the same rows, without a primary key in my DB.

SQL Query looks like this:

SELECT * FROM prueba2 WHERE NOT EXISTS (SELECT * FROM prueba1 WHERE prueba1.ID=prueba2.ID and prueba1.Name=prueba2.Name and prueba1.Age=prueba2.Age)

But, if I have a lot of rows, it's complicated compare each row, so.. Not exist in QV a way to optimize this query in my script?

4 Replies
Gysbert_Wassenaar

Maybe like this. No guarantees it will be faster than your database can do it.

T1:

SELECT distinct ID, Name, age from prueba1;

T2:

left keep

SELECT * FROM prueba2;

drop table T1;



talk is cheap, supply exceeds demand
farolito20
Contributor III
Contributor III
Author

This show me the duplicates rows :s

Gysbert_Wassenaar

Add distinct

T1:

SELECT distinct ID, Name, age from prueba1;

T2:

left keep

SELECT distinct * FROM prueba2;

drop table T1;


talk is cheap, supply exceeds demand
farolito20
Contributor III
Contributor III
Author

This just show the values of the first table 😕