Hi,
if you are using SQL server 2008 , you can use
Rollup to get Total of your query.
select T1.Code,T1.Serv.No,T2.ID,T2.Salary,sum(T2.Salary) asTotalSum from Table1 T1 left outer joinTable2 T2 on
T1.EmpCode=T2.EmpCode and T2.EmpNo= 'E001' group by T1.Code,T1.Serv.No,T2.ID,T2.Salary order
by T1.Code,T1.Serv.No,T2.ID,T2.Salary with rollup
there will be last line with total value.
hope this will help you.
thanks
-amit.