这么个问题,要写好多语句的,都没有分的。
首先,你的表肯定是做了外键等约束的,所以删除,要从最外层删除。假设你的数据库是Sql Server的。
1、技能表
delete from 技能表 where 人物id in (select 人物id from 人物表 where 账号id in (select 账号id from 账号表 where datediff(day,上次登录时间lasttime,getdate())>=3))
2、装备属性表
delete from 装备属性表 where 装备id in (select 装备id from 装备表 where 人物id in (select 人物id from 人物表 where 账号id in (select 账号id from 账号表 where datediff(day,上次登录时间lasttime,getdate())>=3)))
3、装备表
delete from 装备表 where 人物id in (select 人物id from 人物表 where 账号id in (select 账号id from 账号表 where datediff(day,上次登录时间lasttime,getdate())>=3))
4、人物表
delete from 人物表 where 账号id in (select 账号id from 账号表 where datediff(day,上次登录时间lasttime,getdate())>=3)
5、账号表
delete from 账号表 where datediff(day,上次登录时间lasttime,getdate())>=3
温馨提示:内容为网友见解,仅供参考