Stuart Cooper wrote:
Sometimes it's desirable to first to a SELECT to see if a row exists,
and then INSERT if it doesn't already, or UPDATE if it does.

MySQL's got a really handy 'REPLACE INTO' for just this circumstance,
some have suggested that PostgreSQL should support this in future.

The SQL 2003 Standard has a really handy "MERGE INTO" for just this circumstance, too. You can search for "MERGE INTO" on this page to read about it:
http://www.varlena.com/GeneralBits/73.php

I hope both PostgreSQL and MySQL support this in the future.

Your solution looks good.

Thanks.

      Mark

--
http://mark.stosberg.com/

Reply via email to