Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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;
This show me the duplicates rows :s
Add distinct
T1:
SELECT distinct ID, Name, age from prueba1;
T2:
left keep
SELECT distinct * FROM prueba2;
drop table T1;
This just show the values of the first table 😕