|
-
Aug 16th, 2007, 12:57 PM
#1
Thread Starter
Registered User
Check for value before Insert
Hi again,
Using MySQL 5.0.
Say I have a have a simple table with only two fields: the unique auto-incrementing ID and the value.
Can I do this in just a SQL statement?
1) Insert a new value into the table.
2) If the value exists, then just give me the ID so I can use it in my other insert.
3) Otherwise really insert the value and give me the ID.
I've got #1 and #3.
Is it possible to do #2 just in SQL or am I going to have to do a Select statement on the value, check to see if I get results in the language of my choice and then proceed accordingly?
Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|