mysql的if条件控制语句应该怎么用?我想实现如下的功能应该怎么写?
if 10>2
then
insert into (省略)
else
select * from users;
end if
这样的语句在sql server中是没问题但不知道mysql能这样码
if 10>2
then
insert into (省略)
else
select * from users;
end if
这样的语句在sql server中是没问题但不知道mysql能这样码
解决方案 »
- 在win7上配置MySQL服务器的问题。
- 为什么下载的.NET文件中的数据库用SQL打不开?
- 急。。。在线等,请教Mysql 的old_password 密码加密问题,谢谢!!!
- 请教一个触发器的问题
- 用mysql的c接口
- 让两个查询结果合并成一行的sql怎么写?
- windows xp 启动mysql出错,急 急 急
- 关于MS_SQL Server与MySQL的区别?
- 新手请教MYSQL组合索引的问题,请大侠帮忙.
- ODBC连接MySQL异常:未发现数据源名称并且未指定默认驱动程序
- 启动的时候显示Timeout error occurred trying to start MySQL Daemon.
- 各位mysql达人,请教windows下编译mysql5.0.51b遇到找不到bison.exe问题!
if 条件 then
end if
CREATE DEFINER=`root`@`localhost` PROCEDURE `sy2`()
begin
if 10>2 then
select "10";
end if;
end;但是
if 10>2 then
select "10";
end if;
却不行,能单独写带if的语句吗
then
insert into (省略)
else
select * from users;
end if
因为在存储过程里面,主体语句需要放在"BEGIN END"语句块里面