Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing two SQL cursors
Message
De
10/07/1999 08:00:19
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00239523
Message ID:
00239788
Vues:
17
>I have pulled data from two separate SQL tables, and I need to find which rows are different. They have exactly the same structure.
>
>I have the two views which I will call cFirstSQL and cSecondSQL and I did the following thinking that this would work;
>
>SELECT * from cFirstSQL WHERE NOT EXSISTS (SELECT * FROM cSecondSQL)
>
>I get not data, and there are differences.
Mark,
I don't know a practical way of doing this with just one SQL. But a small routine :
LPARAMETERS tcTable1, tcTable2
LOCAL lcGroupBy, ix
USE (tcTable1) in 0 again alias myAlias
lcGroupBy = ""
FOR ix = 1 to fcount("myAlias")
  lcGroupBy = lcGroupBy+iif(empty(lcGroupBy),"",",")+padl(ix,3,"0")
ENDFOR
USE in "myAlias"
SELECT * from (tcTable1) ;
  union all ;
  select * from (tcTable2) ;
  into cursor myCursor
SELECT * from myCursor ;
  having cnt(*)>1 ;
  group by &lcGroupBy ;
  into cursor crsDupRecs
BROW
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform