写存储过程 查询表,得到俩个整数做比较,如果a>b,status=0,否则status=1解决方案
写存储过程 查询表,得到俩个整数做比较,如果a>b,status=0,否则status=1
写存储过程 查询表,得到俩个整数做比较,如果a>b,status=0,否则status=1
create table test
(
a int ,
b.int ,
statur int default 0
)
insert into test values(1,12,0),(32,2,0),(1,12,0),(1,12,0),(1,12,0),(1,12,0);
------解决方案--------------------
写存储过程 查询表,得到俩个整数做比较,如果a>b,status=0,否则status=1
create table test
(
a int ,
b.int ,
statur int default 0
)
insert into test values(1,12,0),(32,2,0),(1,12,0),(1,12,0),(1,12,0),(1,12,0);
------解决方案--------------------
- SQL code
update test set statur=(case when a>b then 0 else 1 end) --直接更新就好了吧,不用存储过程哈
------解决方案--------------------