您的位置:首页 > 数据库 > MySQL

MYSQL 插入数据防止重复

2012-01-04 18:11 429 查看
Sql代码 insert into tt(name,password) select 'phl','123' from dual where not exists(select * from tt where name='phl' and password='123') 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'不存在,则执行插入;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: