id title style isdelete
1 我是中国人 1 0
2 我是中国人 2 0
3 我是中国人 3 0假如我要删除一个传入的 id 的记录:
如果 style=1 ,则直接删除。
如果 style=2 , 则 isdelete=2
如果 style=3 , 则 isdelete=3帮忙写一个。 O(∩_∩)O谢谢
1 我是中国人 1 0
2 我是中国人 2 0
3 我是中国人 3 0假如我要删除一个传入的 id 的记录:
如果 style=1 ,则直接删除。
如果 style=2 , 则 isdelete=2
如果 style=3 , 则 isdelete=3帮忙写一个。 O(∩_∩)O谢谢
解决方案 »
- mysql 视图bigint 问题?奇怪
- 请教一个数据库拷贝的问题
- MySQL服务器最近老是出现很多Locked进程
- PostgreSQL数据库复制
- 关于mysql查询速度问题
- 用JDBC连接MySQL的怪问题
- mysql中一个表的字段太多会不会影响效率?
- MySQL与Acess、SQL server比如何?
- CSV格式文件数据导入新数据库后自动生成主键外键
- mysql主从复制:Slave_IO_Running、Slave_SQL_Running都为Yes,但是不能同步,Last_IO_Error:2003和Last
- 请高手指点!!!!!!!!!!!mysql if not exists 不让用,急急急、!!!!!
- 哪里有 嵌入式的MySQL下载?
begin
declare @st int;
select style into @st from tb where id=idin;
if @st=1
then delete from tb where id=idin;
elseif @st=2
then update tb set isdelete=2 where id=idin;
elseif @st=3
then update tb set isdelete=3 where id=idin;
end if;
end
declare styletmp int default -1;
select style into styletmp from table where id =idtmp ;
if styletmp =1 then
delete from table where id =idtmp
end if;
if styletmp =2 then
delete from table where id=idtmp and isdelete=2;
end if;
if styletmp =3 then
delete from table where id=:idtmp and isdelete=3;
end if;
END