John,
This is the idea I got from Al Doman quite recently (search "Comparing two arrays" thread):
You can do it this way:
pseudo-code
lcUniqueTableName=sys(2015)
select FreeTable
copy structure to (m.lcUniqueTableName)
select (m.lcUniqueTableName)
append from FreeTable
append from DBCTable
lcGroupBy=""
lnFields=fcount()
for i=1 to m.lnFields
lcGroupBy=m.lcGroupBy+field(m.i)+iif(m.i=m.lnFields,'',',')
endif
select *, count(*) as cntDups from (m.lcUniqueTableName) ;
group by &lcGroupBy ;
having cntDups>=2 ;
into cursor curDups
select *, count(*) as cntUnique from (m.lcUniqueTableName) ;
group by &lcGroupBy ;
having cntUnique=1 ;
into cursor curUnique
use in select(m.lcUniqueTableName)
delete file (m.lcUniqueTableName+"*")
>>Yeah, looks like it should work. I would probably do something like this:
>>
>>
>>FUNCTION IsDup
>>LOCAL llDupRec
>>
>>SELE LOCAL_HIV
>>SCATTER MEMO NAME oRecOne
>>
>>SELE CDCHIV
>>SCATTER MEMO NAME oRecTwo
>>
>>IF COMPOBJ( oRecOne, oRecTwo )
>> *Duplicate
>> llDupRec = .T.
>>ELSE
>> *not a duplicate
>> llDupRec = .F.
>>ENDIF
>>
>>RETURN llDupRec
>>
>>
>>Good luck,
>>John
>
>
>REMINDER, this only works on a record by record basis, it could take a while if you are calling it in a scan loop. If you just need to check 2 tables and want to do it quicker, use something like what Brian Givens suggested.
>
>John
If it's not broken, fix it until it is.
My Blog