troubleshooting Question

Insert record into table (if record does not already exist)

Avatar of Rick
Rick asked on
MySQL Server
5 Comments1 Solution3094 ViewsLast Modified:
Hello,

How do I insert a record into a column, if that record does not already exist.
If it does exist, then do nothing:

----------------------------------------------------------------------
INSERT INTO _table (_item) VALUES ('001') ..... ?

If _item 001 does not exist, then insert it, else do nothing.
----------------------------------------------------------------------

Please note that _item IS NOT a primary key, but I can't have duplicates there.

I'm using mysql 5.1.


Thanks,
Rick
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros