Re: sql-question
Posted in 1999
Dieter Powroznik wrote:
> Hi!
> I have in a table 250000 data records. 300 of this records
> are duplicate in one field. How can i with a sql-statement
> delete one of this duplicate records. There are no index
> on this table.
Assuming a table name of tbl , a field name of fld, and database name of
db, this shell script will do what you want (you need not execute the
entire script at once - it would be prudent to do one step at a time):
-------------------------------------------------------------------------------
#!/bin/sh
dbaccess db <<-!
unload to tbl.unl select * from tbl order by fld!
vi tbl.unl # during the vi session, find and delete the desired
row(s)
dbaccess db <<-!
delete from tbl;
load from tbl.unl insert into tbl
exit 0
--------------------------------------------------------------------------------
>
>
> Thanks for help!
> Dieter