I want to enhance this mysql sql statement so that the two columns are only inserted if they don't already exist as a pair in the table.
insert into ingredient_owner (ingredient,owner) select distinct ing, (select owner from recipe where id=recipe_ing.recipe) as owner from recipe_ing where ing is not null;
Need to insert two columns from one table another only if th
Moderator: General Moderators
- barb woolums
- Forum Contributor
- Posts: 134
- Joined: Sun Feb 08, 2009 9:52 pm
Re: Need to insert two columns from one table another only i
Wouldn't a composite index be the easiest solution?
- barb woolums
- Forum Contributor
- Posts: 134
- Joined: Sun Feb 08, 2009 9:52 pm