我用的是mysql ,有这样的一条语句
insert into user(username)values('aaa')
我想判断下表里有没有 用户名为'aaa'的,只有为空的时候才插入,
请问下用一条SQL语句是怎么写的.谢谢!
insert into user(username)values('aaa')
我想判断下表里有没有 用户名为'aaa'的,只有为空的时候才插入,
请问下用一条SQL语句是怎么写的.谢谢!
解决方案 »
- [新手]请教mysql 一天IP1.2万左右 cpu占用100%
- 这个存储过程到底哪里错啦?
- mysql 存储过程 怪现象 急!!!!
- mysql的一个库,既有myisam存储引擎表,又有innodb存储引擎表,如何做备份恢复方案!
- 慢查询的一个奇怪问题
- Cannot proceed because the tables used by events were found damaged at serve
- mysql 去掉两个字段的重复值
- unix下连接window下的mysql 报错 求救了 知道的伸手帮帮我
- xp下MySQL 5.0如何启动?
- 大侠!帮我看看!--可怜的菜菜
- 求MYSQL指定字段合计SQL
- 请教字段名的设计
不但插入了,还一口气插入了3行了
if @cnt = 0 then
insert into user(username) values('aaa');
end if;
insert ignore into user (username) values ( 'aaa ')