mysql条件插入 - 如果不存在insert - 多值插入

时间:2010-02-08 19:27:53

标签: mysql

从我的previous questio n这是我接受的解决方案:

INSERT IGNORE INTO table_name
SET name = 'phill',
    value = 'person',
    id = 12345;

但我也想知道我是否可以成为像这样的多个值

INSERT IGNORE INTO table_name
SET (name = 'phill', value = 'person', id = 12345),
    (name = 'bob', value = 'person', id = 12346);

1 个答案:

答案 0 :(得分:4)

INSERT IGNORE INTO table_name(name,value,id) VALUES 
('phill','person',12345),('bob','person',12346)