Template Information

Home » » mysql insert if condition not exist

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;
Share this article :

0 comments:

Post a Comment