select
( select monthtotal from monthtotal where [month]= month(getdate()) )
-
( select monthtotal from monthtotal where [month]=(case when month(getdate())=1 then 12 else month(getdate())-1 end) )
as diffrence
解决方案 »
- Asp.Net实现Socket 求解。急、急、急在线等。
- 请问设计论坛的发帖模块(ASP.NET GridView控件)应该怎么修改?
- 求助~~~SQL数据库百万数据的实时统计
- 怎么以占资源最小的方式把之读取出来!select count(*) from tb
- 时间权限的判断,大家帮帮忙,急!!!!!!!!!!
- sql 不重复列,如果重复就按日期最新的返回整个表.
- Admin文件夹下Forms验证问题
- 水晶报表导出的pdf对中文不能支持
- 我想显示近段时间内的网站文章的热门关键字,像blogbus.com 那种 ,是怎么做出来的?用asp.net+sql server
- 数据库与网站连接不上
- 我做了广告管理系统,请问怎么取得图片点击率?
- 时间问题
select monthtotal-(select monthtotal from monthtotal where month(yearmonth)=month('某年某月')-1) from monthtotal where month(yearmonth)=month('某年某月')
create table ss
(
date1 datetime primary key,
num int)insert into ss
select '2007-1-1',100
union
select '2007-2-1',120
union
select '2007-3-1',150
union
select '2007-4-1',190
union
select '2007-5-1',220
==============================
select date1, num-(select num from ss where (datepart(month,A.date1)- datepart(month,date1)=1) and
datepart(year,date1)=datepart(year,A.date1) ) from ss A
========================================
2007-01-01 00:00:00.000 NULL
2007-02-01 00:00:00.000 20
2007-03-01 00:00:00.000 30
2007-04-01 00:00:00.000 40
2007-05-01 00:00:00.000 30