you cant use aliases directly like this.make a derived table and then refer derived columns from it.select filedate, switchcode, legaport,minutes,noofcalls,(minutes*1.0/noofcalls) as ACDfrom(select filedate, switchcode, legaport,sum(legatime)*1.0/60 as minutes,count(*) as noofcalls into #mohan from month09..xcda (nolock) where legaport like 'dac%' and filedate like '2008-09-04' group by filedate, switchcode,legaport order by filedate, switchcode,legaport)t