表1: 列是A, 下边是表的查询数据 A
------
19
16
14
10请问我想取出第一列19 减去第二列16怎么写语句? 谢谢!
------
19
16
14
10请问我想取出第一列19 减去第二列16怎么写语句? 谢谢!
解决方案 »
- 怎样执行一个存储过程,将返回来的结果插入到临时表中
- 关于交叉表问题:这段access查询语句用sql server2000写应怎么改???
- 我用的是D版的sql server,刚开始学,请教一下,他最多支持多用户同时连接啊,很多网络版软件用户限制应该是在软件里面控制的吧
- 问一个sql server审核日志的问题
- 运行SQL时出现错误:“不正常地定义参数对象。提供了不一致或不完整的信息”。引起这个错误的原因是什么
- 向sql server2000 的库表中插入数据问题请教
- SQLServer中的Invalid Descriptor Index问题
- 关于sqlserver的启动问题
- 一个比较复杂的select是用视图还是用存储过程实现好此地?分别有什么优缺点
- 在sql server 2000中如何对image型字段(已存放图片)进行更新?(急!!!)
- sal中WHERE子句元组查询的问题?急
- 在视图中能否创建存储过程并执行!是否可有示例,谢谢
create table A(id int)
insert into A
select 19
union all
select 16
union all
select 14
union all
select 10
select identity(int,1,1) as ,id into #t from A
select(select id from #t where =1)-(select id from #t where =3) as result
--drop tables
drop table A
drop table #t
insert into t(A)
select 19
union all
select 16
union all
select 14
union all
select 10
select identity(int,1,1) as id,A into #temp from t
select t1.A-t2.A as A from #temp t1
left join #temp t2 on t2.id=2
where t1.id=1
insert into A
select 19
union all
select 16
union all
select 14
union all
select 10select distinct (select top 1 A from A)-
(
select top 1 A from A where A not in
(
select top 1 A from A
)
) from Adrop table A
select
2*(select top 1 A from A)
-(select sum(A) from (select top 2 A from A) t)楼上也可以去掉 distinctselect (select top 1 A from A)-
(
select top 1 A from A where A not in
(
select top 1 A from A
)
)