[thelist] insert if select fails to find element

Hassan Schroeder hassan at webtuitive.com
Thu Nov 17 09:17:00 CST 2005


Joshua Olson wrote:

> Assuming that you have some sort of constraint on the table that checks for
> uniqueness for the field "word", simply do an INSERT.  If the INSERT errors,

As above, set a UNIQUE index on the field, but use INSERT IGNORE to
convert duplicate-row-errors to warnings.

HTH!
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                          dream.  code.





More information about the thelist mailing list