mysql question
Phillip Qin
Phillip.Qin-szgMhqSEIEG+XT7JhA+gdA at public.gmane.org
Thu Oct 7 17:20:24 UTC 2004
There is a post you might be interested in,
http://www.experts-exchange.com/Databases/Mysql/Q_20920874.html
I know SQL92 doesn't support insert on duplicate key. So it must be MySQL
specific.
-----Original Message-----
From: phil [mailto:phillip-l+pbsqP8NtUm29vl6s1fFg at public.gmane.org]
Sent: October 7, 2004 12:56 PM
To: tlug-lxSQFCZeNF4 at public.gmane.org
Subject: Re: [TLUG]: mysql question
On Oct 7, 2004, at 11:33 AM, hui xu wrote:
> I had a project which need to insert email addresses into mysql table
> with a condition, For example, If the email address is already in the
> mysql table, Do not insert it into MYSQL table. otherwise insert into
> mysql table.
>
> Can anybody tell me how to do it?
The simple way is first to try to retrieve a record with that email
address. If the retrieval succeeds, don't write it.
...or, probably better, make the address a 'UNIQUE' field and then deal
with the error when you try to add it a second time.
...or, when MySQL supports triggers, do it as a stored procedure.
(I've been using PostgreSQL more than MySQL lately, so I'm not sure
which MySQL versions have which features.)
........................
Phillip Mills
Multi-platform software development
(416) 224-0714
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns How to
UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
!DSPAM:41657576311341669238724!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20041007/5d866e20/attachment.html>
More information about the Legacy
mailing list