Thanks for your help Rajeevnandanmishra - ur a great help. Next one for you. What a want to do is use the results from a sum function in a another. I'm having problems with the column:
declare @stock as float, @quant as float
set @stock = '300000'
select Transaction_type ,Transactions = count(all transaction_type),Total = sum( all movement_quantity ), datepart(wk, dated) AS 'week', datepart(yy, dated) AS 'YEAR' from st_history
where transaction_type not in
( 'TRAN','SCRP','BINT','SRET','DESP','RINV','SALE', 'ADJ')
and dated between '2000-07-01' and '2001-06-24'
group by datepart(wk, dated), datepart(yy, dated) , transaction_type
order by week, transaction_type
declare @stock as float, @quant as float
set @stock = '300000'
select Transaction_type ,Transactions = count(all transaction_type),Total = sum( all movement_quantity ), datepart(wk, dated) AS 'week', datepart(yy, dated) AS 'YEAR' from st_history
where transaction_type not in
( 'TRAN','SCRP','BINT','SRET','DESP','RINV','SALE', 'ADJ')
and dated between '2000-07-01' and '2001-06-24'
group by datepart(wk, dated), datepart(yy, dated) , transaction_type
order by week, transaction_type