mysql数据库中的自增字段会不会溢出,我用的是int,万一超过这个int的表示范围会怎样
4个回答
推荐于2018-03-02 · 知道合伙人互联网行家
关注
展开全部
不知道你是oracle还是sql server?这个是个自连接问题,先要排序,标行号,再同表的上下行相比,所以是自连接
orcale:
select a.vseq,a.declaredate as declaredate1,b.declaredate as declaredate2
from
(select vseq,declaredate,rownum as row from mac505 order by vseq,declaredate)a,
(select vseq,declaredate,rownum as row from mac505 order by vseq,declaredate)b
where a.vseq=b.vseq and a.row+1=b.row and a.declaredate+1000<b.declaredate
sql server由于只有2005以上版本才有row_number()函数,所以如下脚本只能用在2005以上版本中
select a.vseq,a.declaredate as declaredate1,b.declaredate as declaredate2
from
(select vseq,declaredate,row_number() orver (order by vseq,declaredate) as row from mac505 )a,
(select vseq,declaredate,row_number() orver (order by vseq,declaredate) as row from mac505 )b
where a.vseq=b.vseq and a.row+1=b.row and a.declaredate+1000<b.declaredate
orcale:
select a.vseq,a.declaredate as declaredate1,b.declaredate as declaredate2
from
(select vseq,declaredate,rownum as row from mac505 order by vseq,declaredate)a,
(select vseq,declaredate,rownum as row from mac505 order by vseq,declaredate)b
where a.vseq=b.vseq and a.row+1=b.row and a.declaredate+1000<b.declaredate
sql server由于只有2005以上版本才有row_number()函数,所以如下脚本只能用在2005以上版本中
select a.vseq,a.declaredate as declaredate1,b.declaredate as declaredate2
from
(select vseq,declaredate,row_number() orver (order by vseq,declaredate) as row from mac505 )a,
(select vseq,declaredate,row_number() orver (order by vseq,declaredate) as row from mac505 )b
where a.vseq=b.vseq and a.row+1=b.row and a.declaredate+1000<b.declaredate
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
-2147483648-2147483647 超出的话 sql语句报错呗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
主键重复 无法插入数据。。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询