Tuesday, January 10, 2012

Get Quarter start end date (For TNT)

select fyear, quarter, min(startdt) startdt, max(enddt) enddt
from (
select *,(round((Period-1)/3,0)+1)  as quarter
from fiscalperiod where Fyear = '20112012' ) a
group by fyear, quarter


select fyear,(round((Period-1)/3,0)+1)  as quarter, min(startdt) startt, max(enddt)endt
from fiscalperiod where Fyear = '20112012'
group by fyear,(round((Period-1)/3,0)+1)