Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Add rows based on column value

Author  Topic 

kieran5405
Yak Posting Veteran

96 Posts

Posted - 2007-05-15 : 07:01:34
Hi,

I am trying to get this working in a sql query. I have the below query which gets the username and adds two column values together to get a total amount.

SELECT NTuser, Convert(VARCHAR(100), sum(TravelAmount + SubAmount), 1) as 'TotalAmount' FROM Expenses

However, there will be many rows for the same username so what I need to do is return only one row per username with the total of all the users 'TotalAmount'.

Any help much appreciated.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-15 : 07:03:38
duplicate http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=83588


KH

Go to Top of Page
   

- Advertisement -