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)
 How to name a column that has sum(value)

Author  Topic 

eurob
Posting Yak Master

100 Posts

Posted - 2005-08-12 : 14:02:17
When I do: select sum(x) as mysum,

I would expect to see the 'mysum' in header of the column.

Anyone knows how to achieve that ?

Thanks,

robert

robert

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-12 : 14:09:38
Yes SUM(x) AS MySum works. Did you try it out in Query Analyzer or is this from your application? If from your application, then that's where the problem is as what you have posted works.

Here's a sample to try out in Query Analyzer:
SELECT SUM(dbid) AS SUMDBID
FROM master.dbo.sysdatabases

Tara
Go to Top of Page

eurob
Posting Yak Master

100 Posts

Posted - 2005-08-12 : 14:14:53
Thank you, I realize I asked the wrong question.
I needed it for a subquery.


robert
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-12 : 14:37:14
If it's for a subquery, please post the query so that we can help you better.

Tara
Go to Top of Page

eurob
Posting Yak Master

100 Posts

Posted - 2005-08-12 : 14:39:53
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=53692

robert
Go to Top of Page
   

- Advertisement -