List:General Discussion« Previous MessageNext Message »
From:Afan Pasalic Date:December 16 2007 5:29pm
Subject:Re: Update but insert if not exist
View as plain text  
try REPLACE
http://dev.mysql.com/doc/refman/5.1/en/replace.html

-afan

Steffan A. Cline wrote:
> I am trying to think of a trick way to handle something. I have been
> successful in using the multiple inserts in one row by using the
> ,(xx,xx,xx),(xx,xx,xx),(xx,xx,xx) in a values block. BUT Is it possible to
> insert if not there for example
> 
> 
> Update xxxx
>     if anyone not found then insert new with same criteria as update
> Where region_id in (2,3,4,5,6)
> 
> 
> 
> Thanks
> 
> Steffan
> 
> ---------------------------------------------------------------
> T E L  6 0 2 . 7 9 3 . 0 0 1 4 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
> Steffan A. Cline 
> Steffan@stripped                             Phoenix, Az
> http://www.ExecuChoice.net                                  USA
> AIM : SteffanC          ICQ : 57234309
> YAHOO : Steffan_Cline   MSN : steffan@stripped
> GOOGLE: Steffan.Cline             Lasso Partner Alliance Member
> ---------------------------------------------------------------
> 
> 
> 
> 
Thread
Update but insert if not existSteffan A. Cline16 Dec
  • Re: Update but insert if not existAfan Pasalic16 Dec
    • Re: Update but insert if not existRob Wultsch17 Dec
  • Re: Update but insert if not existJ Trahair17 Dec
    • Re: Update but insert if not existJay Pipes17 Dec