以下SQL就实现点卡需要用的SQL语句
update TB_user set iDate = @date +iPoint where iPoint <> 0
update TB_user set iPonit = 0 where iPoint <> 0
--充点后自动更改时间
需要每小时运行一次的
Truncate table Temp
insert into Temp (User) (select strAccountID from TB_user where @date >iDate and @mouth >= iMouth)
--选取过期账号
update a set a.Authority = 255
from userdate a,Account_char b,Temp c
where ((a.strUserID = (select b.strCharID1 from b where b.strAccountID = c.User )
or (a.strUserID = (select b.strCharID2 from b where b.strAccountID = c.User )
or (a.strUserID = (select b.strCharID3 from b where b.strAccountID = c.User ))
--停权过期账号
DELETE FROM userdata where struserID = (select strCharID1 from Account_char where Account_char.strAccountID <> (select strAccountID from TB_user))
DELETE FROM userdata where struserID = (select strCharID3 from Account_char where Account_char.strAccountID <> (select strAccountID from TB_user))
DELETE FROM userdata where struserID = (select strCharID2 from Account_char where Account_char.strAccountID <> (select strAccountID from TB_user))
DELETE FROM warehouse where strAccountID = (select strCharID1 from Account_char where Account_char.strAccountID <> (select strAccountID from TB_user))
DELETE FROM warehouse where strAccountID = (select strCharID3 from Account_char where Account_char.strAccountID <> (select strAccountID from TB_user))
DELETE FROM warehouse where strAccountID = (select strCharID2 from Account_char where Account_char.strAccountID <> (select strAccountID from TB_user))
DELETE FROM Account_char where strAccountID = (select strCharID1 from Account_char where Account_char.strAccountID <> (select strAccountID from TB_user))
DELETE FROM Account_char where strAccountID = (select strCharID3 from Account_char where Account_char.strAccountID <> (select strAccountID from TB_user))
DELETE FROM Account_char where strAccountID = (select strCharID2 from Account_char where Account_char.strAccountID <> (select strAccountID from TB_user))
--删除不能选取的角色
下面的是制作对应网页需要用到的SQL
充点网页
添加的变量@account,@Num,@Passage
要用的SQL语句
update a.iPoint = TB_iPoint + b.iPoint , b.iPoint = 0
from TB_user a,Point b
where a.strAccountID = @account and b.iNum = @Num and b.iPassage = @passage
--充点网页
查询剩余天数的网页
添加变量@Account
--查询剩余天数
--输出
select @date - iDate from TB_user where strAccountID = @Account |