Add a UNIQUE INDEX to the table you are inserting to.  You will then get
an error if you try to insert a second time with the same values.
Alternativly you could use perform a select and then an insert within
the same transaction, determining whether something exists in the db
before inserting.  This of course would require transactions supported
by InnoDB tables and not supported by MyISAM.

~Wynne

-----Original Message-----
From: Wileynet [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 2:04 PM
To: 'mysql users'
Subject: Beginner question - Preventing Duplicate Entries


Is there a sql statement that would not allow the same entry twice.
Something like INSERT into myTable s WHERE s != Value(?). I don't know
if that makes sense but I thought I would give it a shot.

Basically I want to know if it is possible and if so can you point me to
a webpage or give me an example if you can?

Thanks in advance -
Wiley



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to