SQL Server中有没有一种方法可以从具有日期列(1998到2010)的表中显示会计年度(从10月1日开始到9月30日结束)。以下是我所做的:SQL Server 2008问题
select 'FY1999' as FY, site, count(*) from mytable
where mydate >='10/1/1998' and mydate <'10/1/1999'
group by site
select 'FY2000' as FY, site, count(*) from mytable
where mydate >='10/1/1999' and mydate <'10/1/2000'
group by site
select 'FY2001' as FY, site, count(*) from mytable
where mydate >='10/1/2000' and mydate <'10/1/2001'
group by site
这样做不是太多的重复,当这样做超过10财年?
你想要什么恰好说明了什么? – CesarGon 2010-10-09 01:21:05
你的问题并不十分清楚。尝试将你的问题看作是*不知道你脑子里发生了什么的人。 – 2010-10-09 01:21:34