I want to avoid doing a two step process outside the db... I want to
insert a row only if it doesn't exist already. REPLACE INTO seems to
almost do the trick, however, seems like it will UPDATE if the row
already exists. I want the row to be left alone if it exists.
Am trying to figure out if EXISTS could be creatively used to do this
SELECT EXISTS (SELECT id FROM t WHERE id = 5)
return 1 if 5 exists, and 0 if it doesn't exist. Is it possible to do
an INSERT based on this? Or, do I have to use the logic in my
application? My brain is not working, so any help on this would be
appreciated.
--
Puneet Kishor