编程论坛
注册
登录
编程论坛
→
SQL Server论坛
SQL命令,如果往指定的会员卡里添加金额 应该怎么编辑?内详!
hao7856
发布于 2017-08-16 15:42, 1343 次点击
delete from mb_member where mb_cardcode='会员卡号'
这个删除指定的会员卡
如果往指定的会员卡里添加金额
应该怎么编辑
大神帮帮忙~在线等~
1 回复
#2
mywisdom88
2017-08-16 16:44
假设你 mb_member(mb_cardcode,mb_name,mb_cash)
-- 删除会员卡
delete from mb_member where mb_cardcode='会员卡号'
-- 更新会员金额 ,增加100
update mb_member set mb_cash = mb_cash + 100.00 where mb_cardcode='会员卡号'
-- 更新会员金额 ,减少100
update mb_member set mb_cash = mb_cash - 100.00 where mb_cardcode='会员卡号'
-- 更新会员金额 ,增加/减少 N
declare @mb_cash numeric(10,2)
set @mb_cash= 120
update mb_member set mb_cash = mb_cash + @mb_cash where mb_cardcode='会员卡号'
set @mb_cash= -50
update mb_member set mb_cash = mb_cash + @mb_cash where mb_cardcode='会员卡号'
1