请问下面的查询用一条SQL语句怎么实现? 表结构如下:ID1 ID2 1 3 5 8 1 10 2 2怎么找出ID1-ID2的差值最大的记录?这里要输出1 10 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不好意思, 打反了怎么找出ID2-ID1的差值最大的记录?这里要输出1 10 select *from 表where id2-id1=(select max(id2-id1) from 表名) create table #t (ID1 int, ID2 int)insert into #t select 1, 3insert into #t select 5, 8insert into #t select 1, 10insert into #t select 2, 2select *from #twhere id2-id1=(select max(id2-id1) from #t) drop table #t varchar和datetime互转为隐性,还有必要使用Cast和Convert么 请帮我看下这个ER图一对一约束的关系 一个sql语句问题 数据库 数据丢失 输出数据值上限问题,在线等高手!!! sql中关于日期更新 数据库发生附加错误,怎样修复? 紧急求助:一个简单的查询命令出错。十万火急!! 不是有效的标识符,请高人指教! EXCEL导入SQL SERVER的问题 求一条sql 求一SQL语句
1 10
from 表
where id2-id1=(select max(id2-id1) from 表名)
insert into #t select 5, 8
insert into #t select 1, 10
insert into #t select 2, 2select *
from #t
where id2-id1=(select max(id2-id1) from #t)
drop table #t