Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compare 2 or more rows from the same table for differenc
Message
From
29/06/2006 11:20:40
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01132653
Message ID:
01132773
Views:
13
>Hi all
>
>Maybe I am growing old but is there an easy way to compare records from the same table for differences, rather more like a list of differences. I have to get the non-tech/low-tech to compare select data for such differences thus the need for a utility.

You might try something like this:
Select t1
Set Textmerge To Memvar m.lcJoin Noshow
Set Textmerge On
For ix =1 To Fcount()
\\<<IIF(m.ix=1,'',' AND ')>> t1.<<FIELD(m.ix)>> == t2.<<FIELD(m.ix)>>
Endfor
Set Textmerge To
Set Textmerge Off
lcw1 = Textmerge("WHERE ISNULL(t2.<<FIELD(1)>>)")
lcw2 = Textmerge("WHERE ISNULL(t1.<<FIELD(1)>>)")

Select t1.* ;
  FROM t1 Left Join t2 On ;
  &lcJoin ;
  &lcW1 ;
  UNION ;
  Select t2.* ;
  FROM t1 Right Join t2 On ;
  &lcJoin ;
  &lcW2 ;
  INTO Cursor crsDiff
browse
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform