| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Douglas Pearson | Date: | April 13 2007 8:14am |
| Subject: | Is it possible to either update or insert in a single query? | ||
| View as plain text | |||
Apologies if this is a dumb question, but is it possible to write a single query that either updates certain columns in a row, or adds an entirely new row if there is none already? I seem to be running into this a lot, and so far I've solved it by: 1) run UPDATE table SET x,y WHERE some row 2) if rowsChanged == 0 then run the INSERT It just feels like there must be a way to do this more efficiently. Thanks, Doug
| Thread | ||
|---|---|---|
| • Is it possible to either update or insert in a single query? | Douglas Pearson | 13 Apr |
| • Re: Is it possible to either update or insert in a single query? | Carlos Proal | 13 Apr |
| • Re: Is it possible to either update or insert in a single query? | Mogens Melander | 13 Apr |
| • RE: Is it possible to either update or insert in a single query? | Douglas Pearson | 13 Apr |
| • RE: Is it possible to either update or insert in a single query? | Randall Price | 13 Apr |
| • Re: Is it possible to either update or insert in a single query? | Martijn Tonies | 13 Apr |
