General discussion

Locked

Visual FoxPro Table Comparison

By jmartin ·
I'm using Visual FoxPro 6.0 and I'm trying to create a query that would select records out of one table that are not in a second table and since I have very large tables I need it to be quick. I've been able to get the desired result but it's slow. I've not been able to find a true "comparison" for tables. Does anyone have any suggestions? Thanks, JMartin

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Visual FoxPro Table Comparison

by jp-mattenet In reply to Visual FoxPro Table Compa ...

jmartin,
Are you doing this on a procedure or as a SQL Statement? With SQl you can use the Operator EXIST:
SELECT T1.PK
FROM T1
WHERE NOT EXIST (SELECT T1.PK WHERE T1.PK = T2.PK)
(Check that indexes exist for T1.PK and T2.PK)
It there any way you can reduce the number of records? For example if you do this every week, it may be posible to filter the changes by date?

Hope it helps,
JP

Collapse -

Visual FoxPro Table Comparison

by jmartin In reply to Visual FoxPro Table Compa ...

Thanks, got me started inright direction.

Collapse -

Visual FoxPro Table Comparison

by edik In reply to Visual FoxPro Table Compa ...

select * from t1 a ;
where a.code NOT IN (select b.code from t2 b;
where a.code=b.code)

OR select * from t1 a outer join t2 b ;
where a.code <> b.code

There should be indexes "a.code" and "b.code"
Good luck

Collapse -

Visual FoxPro Table Comparison

by jmartin In reply to Visual FoxPro Table Compa ...

Thanks, this helped

Back to Web Development Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums