Board index » delphi » duplicate files in unindexed database?

duplicate files in unindexed database?

"Duplicate files"?  Do you mean duplicate rows?  If so, then what do you
consider "duplicate"?  All of the fields the same or just some of the fields
the same?

In any case, create a unique index containing all of the fields that
together would fulfil your duplicate test.  Paradox will throw out the
duplicates and then you can remove the unique index.

 

Re:duplicate files in unindexed database?


The easiest way is to run a query on the table with an ORDER BY clause that
will sort the result set so that duplicate records are adjacent. BatchMove
the query result set to a table and write a program to compare adjacent
records and delete the duplicates. To compare adjacent records use two
TTables.

Bill

--

Bill Todd - TeamB
(TeamB cannot respond to questions received via email)

Re:duplicate files in unindexed database?


Hello My name is Richard Caruana
carua...@acay.com.au
Is there an easy way to remove duplicate files from a Paradox 7 table?

Re:duplicate files in unindexed database?


How do you write a program to compare files and delete duplicates
sorry if I am sounding stupid
Quote
Bill Todd wrote:
> The easiest way is to run a query on the table with an ORDER BY clause that
> will sort the result set so that duplicate records are adjacent. BatchMove
> the query result set to a table and write a program to compare adjacent
> records and delete the duplicates. To compare adjacent records use two
> TTables.

> Bill

> --

> Bill Todd - TeamB
> (TeamB cannot respond to questions received via email)

Re:duplicate files in unindexed database?


It depends on how you define "duplicate". If duplicate means the same values
in all of the fields then you can do the whole job in a query.

SELECT DISTINCT * FROM MyTable

The DISTINCT keyword will cause all duplicate records to be dropped.
Otherwise you will have to use code. Assuming two TTable components both
pointing to the table with the duplicates then try something like this. Note
that this code has not been tested.

Table1.Open;
Table2.Open;
while not Table1.EOF do
begin
  Table2.GotoCurrent(Table1);
  Table2.Next;
  if Table1.FieldByName('SomeField').Value <>
     Table2.FieldByName('SomeField').Value then
  begin
    Table2.Delete;
    Continue;
  end;
  Table1.Next;
end;

Bill
--

Bill Todd - TeamB
(TeamB cannot respond to questions received via email)

Other Threads