Subject | How to insert only if a matching row does not exist? |
---|---|
Author | Ed Grochowski |
Post date | 2011-10-20T00:40:42Z |
Using SQL only (no stored procedures), how do I construct a statement to insert values into a database table, if and only if, a row containing a field with a specific value does not already exist?
In Sql Server (and others), you can do things like the following:
IFNOTEXISTS(SELECT1FROMemp WHEREfruits ='mango')
INSERTINTOemp (fruits)VALUES('mango')
What is the analogous way to achieve this in Firebird (2.5) ?
[Non-text portions of this message have been removed]
In Sql Server (and others), you can do things like the following:
IFNOTEXISTS(SELECT1FROMemp WHEREfruits ='mango')
INSERTINTOemp (fruits)VALUES('mango')
What is the analogous way to achieve this in Firebird (2.5) ?
[Non-text portions of this message have been removed]