from: http://dev.mysql.com/doc/refman/5.1/en/insert.html:
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
SET col_name={expr | DEFAULT}, ...
[ ON DUPLICATE KEY UPDATE
col_name=expr
[, col_name=expr] ... ]
The ON DUPLICATE KEY predicate tells you that if you create a unique
key for when ever your 'search' criteria is, you can get this
behaviour like so:
INSERT INTO mytable SET col1 = val1, ... ON DUPLIATE KEY UPDATE
- michael dykman
On Sun, Jul 26, 2009 at 1:11 PM, Victor Subervi<[email protected]> wrote:
> Hi;
> I would like to test the following:
>
> update maps set map where site=mysite;
>
> to see if there is such an entry in maps. If there is, then update. If there
> is not, then I would like to execute an insert statement. How do I do that?
> TIA,
> Victor
>
--
- michael dykman
- [email protected]
Don’t worry about people stealing your ideas. If they’re any good,
you’ll have to ram them down their throats!
Howard Aiken
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[email protected]