General discussion

  • Creator
    Topic
  • #2082652

    Visual FoxPro Table Comparison

    Locked

    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

All Comments

  • Author
    Replies
    • #3895653

      Visual FoxPro Table Comparison

      by jp-mattenet ·

      In reply to Visual FoxPro Table Comparison

      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

    • #3778131

      Visual FoxPro Table Comparison

      by edik ·

      In reply to Visual FoxPro Table Comparison

      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

Viewing 1 reply thread