现在我要写个关于酒店换房的存储过程,需要操作表有openlog开房表,fee消费表,room房间信息
字段有openlog.handleid(手牌号),room.id(标识自动增长的编号),room.handle(房间号),room.state(房间状态)String sqlid="select openlog.handleid from openlog where handleid in (select room.id from room where handle='"+newroom+"')";//newroom从页面得到新的房间号,根据newroom得到手牌号,并给予下面的sql语句
update openlog set handleid='"+sqlid+"' where handleid=hand";//hand页面穿过来原来的手牌号
update fee set handleid='"+sqlid+"' where handleid=hand;
update room set state=0 where state=1 and handle=hand";
update room set state=1 where state=0 and handle='"+newroom+"' 我这样写对吗?如果可以,
照这样应该需要个in 的参数,具体应该怎样写存储过程呀???
字段有openlog.handleid(手牌号),room.id(标识自动增长的编号),room.handle(房间号),room.state(房间状态)String sqlid="select openlog.handleid from openlog where handleid in (select room.id from room where handle='"+newroom+"')";//newroom从页面得到新的房间号,根据newroom得到手牌号,并给予下面的sql语句
update openlog set handleid='"+sqlid+"' where handleid=hand";//hand页面穿过来原来的手牌号
update fee set handleid='"+sqlid+"' where handleid=hand;
update room set state=0 where state=1 and handle=hand";
update room set state=1 where state=0 and handle='"+newroom+"' 我这样写对吗?如果可以,
照这样应该需要个in 的参数,具体应该怎样写存储过程呀???
解决方案 »
- mysql设置外键来查询与不设置外键建立联合查询有什么不同?
- Linux下mysql中:如何把character_set_system编码修改为gbk
- 一个小问题,求教!!
- 数据库java时间不一致
- 用MySQL Instance Manager启动MySQL的问题
- MYSQL的视图如何加个主键啊?
- navicat連不上mysql
- MySql远程访问的一个问题
- update替换语句如何写?
- 如何快速复制数据库?不是主从复制,而是类似于sqlite或access复制文件那样的快速复制
- mysql数据库 存储分页问题
- mysql 奇怪的问题。查询以 孙 开头的字段,连 任,宋 都能查出来 .为什么?
label:BEGIN
declare id int;
declare ids varchar(500);
END$$DELIMITER ;