| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Kyong Kim | Date: | March 23 2010 11:48pm |
| Subject: | SELECT and INSERT if no row is returned | ||
| View as plain text | |||
I need to INSERT a row into a table only if it does not exist to insure that there won't be duplicate rows. Due to the the usage case and the design of the primary key, non-unique id + auto increment, I don't think insert ignore is an option. What would be simplest and cheapest way to make sure that given the following schema create table some_table ( parent_id int //non-unique seq_id int auto_increment ) ENGINE=INNODB that no row with the same parent_id can be inserted? Kyong
| Thread | ||
|---|---|---|
| • SELECT and INSERT if no row is returned | Kyong Kim | 24 Mar |
| • Re: SELECT and INSERT if no row is returned | Johnny Withers | 24 Mar |
| • Re: SELECT and INSERT if no row is returned | Rodrigo Ferreira | 24 Mar |
| • Re: SELECT and INSERT if no row is returned | Kyong Kim | 24 Mar |
| • Re: SELECT and INSERT if no row is returned | Shawn Green | 24 Mar |
