Title: RE: duplicate records check
Hi Neil,
try something like this
SELECT your_field
FROM your_table
GROUP BY your_field
HAVING COUNT(*) 1
Mit freundlichen Grssen
Frank Kalis
Asset Management
ProACTIV___
CiV Versicherungen * PB Versicherungen
Hi Neil,
1) You could ask for the count of each listed item in a column.
something like:
SELECT item, count(item) from parts GROUP BY item;
2) you could then use
SELECT id,item from parts WHERE item = 'xxx';
to review the double entries.
This is just a general sample, perhaps if you give
Hello Steve,
Do a select on the record before you insert it. If the record does not exist in the
database (i.e. mysql_num_rows () == 0) than it is safe to do the insert.
John
-Original Message-
From: Steve Marquez [mailto:[EMAIL PROTECTED]
Sent: Friday, June 06, 2003 3:41 PM
To: MySQL
You can always catch the Duplicate Key error and respond accordingly in
your PHP script.
Regards,
Mike Hillyer
www.vbmysql.com
-Original Message-
From: Steve Marquez [mailto:[EMAIL PROTECTED]
Sent: Friday, June 06, 2003 1:41 PM
To: MySQL List
Cc: PHP eMail List
Subject: Duplicate
Insert.
PB
-
- Original Message -
From: John Griffin
To: Steve Marquez ; MySQL List
Cc: PHP eMail List
Sent: Friday, June 06, 2003 2:51 PM
Subject: RE: Duplicate records
Hello Steve,
Do a select on the record before you insert it. If the record does not
exist
A quick method is to create a new table:
CREATE TABLE newtable SELECT DISTINCT * FROM oldtable;
note; manually verify newtable has your data. Then proceed:
DROP TABLE oldtable;
CREATE TABLE oldtable SELECT * FROM newtable;
DROP TABLE newtable;
-Original Message-
From: Rich
any reason not to select distinct into a tmp table?
On Sun, 10 Feb 2002, DL Neil wrote:
Rich,
How does one go about removing one of two identical records in a MySQL
database? My mistake in an earlier database was not applying a unique
number to each record (1, 2, 3, ---). I know it's
Rich,
How does one go about removing one of two identical records in a MySQL
database? My mistake in an earlier database was not applying a unique
number to each record (1, 2, 3, ---). I know it's possible to use the
DISTINCT operator to show only one of the identical records in a result,
Hi,
You can try to use ALTER IGNORE TABLE syntax :
ALTER IGNORE TABLE your_table ADD UNIQUE(Id);
Regards,
Jocelyn Fournier
- Original Message -
From: Rich [EMAIL PROTECTED]
To: MySql [EMAIL PROTECTED]
Sent: Sunday, February 10, 2002 5:31 PM
Subject: Duplicate Records
How does one
Dan,
[I've cc-ed this to the list and to Rich - who asked the original question]
You can do the following to remove duplicates:
- create table foo as select distinct cols from
table_name_containing_duplicates;
- drop table_name_containing_duplicates;
- alter table foo rename to
Rich,
How does one go about removing one of two identical records in a MySQL
database? My mistake in an earlier database was not applying a unique
number to each record (1, 2, 3, ---). I know it's possible to use the
DISTINCT operator to show only one of the identical records in a result,
Hi,
You can try to use ALTER IGNORE TABLE syntax :
ALTER IGNORE TABLE your_table ADD UNIQUE(Id);
Regards,
Jocelyn Fournier
- Original Message -
From: Rich [EMAIL PROTECTED]
To: MySql [EMAIL PROTECTED]
Sent: Sunday, February 10, 2002 5:31 PM
Subject: Duplicate Records
How does one
!! -- this will avoid duplicates.
Regards,
Dan
-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: Monday, 11 February 2002 8:30 a.m.
To: Rich; MySql
Subject: Re: Duplicate Records
Rich,
How does one go about removing one of two identical records in a MySQL
database? My mistake
13 matches
Mail list logo