mysql 中插入数据查重sql语句

insert into tt(name,password) select 'phl','123' from dual where not exists(select * from tt where name='phl' and password='123')

这个SQL语句的含义是,如果插入的数据 name='phl',password='123'不存在,则执行插入;

posted on 2012-09-24 10:21  larryle  阅读(840)  评论(0)    收藏  举报