Re[2]: sql question
Posted in 1997
Nigel,
Your method is the best if there is a high percentage of duplicates in
the table. For a low volume, I like the idea of using the tid for
uniqueness.
Regards
David Ashby
______________________________ Reply Separator _________________________________
Subject: Re: sql question
Author: Nigel Gall <nigelg@ppsl.com> at WCA-INET
Date: 08/12/97 12:29 PM
Hi!
I've been watching all the responses to this, which advise selecting
unique, count(*) into temp, then deleting with a subselect, and
re-inserting from temp.
Why can't we, to make the process simple, just:
Unload all rows to a file (serves as backup if you make a mess):
unload to "dupl_rows.unl"
select * from mytable
order by 1, 2, 3, 4, 5, ..., n {where n = number of columns in mytable}
Run unix uniq command on file dupl_rows.unl:
$ uniq dupl_rows.unl > unique_rows.unl
Then delete all rows from mytable:
delete from mytable
Then reload from unique_rows.unl:
load from "unique_rows.unl"
insert into mytable
Any views?
Best regards,
Nigel
+-------------------------------------------------------------+
|Name : Edmund Nigel Gall Tel: (868) 636 3153 |
|Title : Information Systems Specialist Fax: (868) 679 3770 |
|Company: Process Plant Services Limited |
|Address: Atlantic Avenue, Point Lisas Industrial Estate |
| Point Lisas, Couva, Trinidad & Tobago, W.I. |
+----- mailto:nigelg@ppsl.com ------ http://www.ppsl.com -----+