General Databases (73) InterBase (29) MS-SQL (5) mysql (37) Oracle (1) Linux (41) Outside the Cube (5088) Programming (679) Web publishing (65) Windows (431)
Exchange Links About this site Links to us 

|
General :: Databases
Database installation, programming and administration.
Articles:
This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Featured Article
Remove duplicate rows from a table - independent from indexesQuestion: I need to remove duplicate rows from my table. It has an autoincrement integer as primary key and a few other attributes (PROD_ID, RESOURCE_ID, DATE_ADDED). What's the easiest way to do that?
Answer: Follow these steps:
- Create a temporary second table with an identical structure to your table. Run a select statement with the keyword DISTINCT on the desired attributes. That means, leave out the attributes that do not make a row 'unique'.
- If you have cascading deletes, constraints or (on delete) triggers defined on your table, then temporarily disable them.
- Now empty your table.
- Then insert from your temporary table into your original.
- Enable your triggers or constraints again.
 | |  | |
create table product_to_resources (
pr_id int autoincrement;
prod_id int;
resource_id int;
date_added datetime;
);
create table TMP_product_to_resources (
pr_id int autoincrement;
prod_id int;
resource_id int;
date_added datetime;
);
delete from TMP_product_to_resources;
insert into TMP_product_to_resources
(prod_id, resource_id, date_added)
select distinct prod_id, resource_id, date_added
from product_to_resources;
delete from product_to_resources;
insert into product_to_resources
(prod_id, resource_id, date_added)
select distinct prod_id, resource_id, date_added
from TMP_product_to_resources;
| |  | |  |
|
| Most recent comments
2010-03-20 03:57:17:
by anonymous
in Dating Scams
on Dating scammer Priscilla Mason or Munsa:
priscilla hammond accra
|
2010-03-20 03:18:58:
by anonymous
in Dating Scams
on Dating scammer Sarah Sarpong:
HELLO THIS IS TODD IMANUAL PECK I AM SORY I POSTED BAD THINGS ABOUT SARAH SARPONG, SHE WAS A GOOD GIRL BUT SHE DISTROY MY HEART BY NOT LOVING ME THE WAY I LOVE HER, I AM LOOKING FOR HER SO IF ANY ONE ... read more
|
2010-03-20 03:16:00:
by [hidden]
in Dating Scams
on Dating scammer Rosina Amma Darkoah:
This little trick really gets around ! Jamaica, South Beach, FL and Las Vegas at different times of the year. An expensive 'call girl' does porn flicks and she's excellent at what she does. You need ' ... read more
|
2010-03-20 02:41:45:
by [hidden]
in Dating Scams
on Dating scammer Yuliya Nikolaevskaya:
And another picture she emailed me with
After her third email when I told her no thanks, I thought of googling her email address (kellybleeks@hotmail.com) and found this site. Well done guys, ... read more
|
2010-03-20 01:55:54:
by anonymous
in JavaScript
on How to prompt the user with an inputbox in Javascript:
fgfdg
|
2010-03-20 01:41:46:
by anonymous
in Dating Scams
on Scammer Jane Mabou from Ivory Coast, Africa:
Hi everyone..you wont believe it but this lady is contacting even lesbians in Czech republic too:) Just today ive recuieved this mail:
i am lady Juliet Mabou,your new friend i saw your profil ... read more
|
2010-03-20 01:17:56:
by anonymous
in Dating Scams
on Dating scammer Rhoda Naa from Accra, Ghana:
need some information on a email and name, from Ghana accra. the name is fafa affi, email is fafalovesu@yahoo.com. doea any one know this name was sent with some pics i got. Mr.Usa
|
2010-03-20 00:20:19:
by DOC
in Dating Scams
on Dating scammer Sandra Da_Rocha from Accra/Ghana:
anonymous from United States,
Respect the posting policy.
[quote]Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owne ... read more
|
|
2010-03-20 00:14:48:
by DOC
in Dating Scams
on Dating scammer Michelle Daniel:
anonymous from United States,
No Nude pix please.
|
2010-03-20 00:06:38:
by DOC
in Dating Scams
on Dating scammer Olga:
Liliya (princes77@yandex.ru)
|
|