Template Information

Latest Post

Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

mysql insert if condition not exist

Written By xx on Wednesday, June 12, 2013 | 7:30 PM

INSERT INTO table_listnames (name, address, tele)
SELECT * FROM (SELECT 'John', 'Doe', '022') AS tmp
WHERE NOT EXISTS (
    SELECT name FROM table_listnames WHERE name = 'John'
) LIMIT 1;