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
 General SQL Server Forums
 New to SQL Server Programming
 Field Count Problems

Author  Topic 

wsilage
Yak Posting Veteran

82 Posts

Posted - 2014-09-12 : 09:43:01
I know I have had this before, but I can't remember what I did to fix it.

I have a field that is varchar. I need to count the numbers up.

Example

Claim Count
37
6

When I do my query

Select Distinct count([Claim]) from Table

It comes up with 2.

How do I have it recognize that I need the actual number count? I need it to be 43.

Arun Babu N
Starting Member

26 Posts

Posted - 2014-09-12 : 09:58:19
Select sum(cast([Claim] as int)) from Table


Arun Babu N
Go to Top of Page

wsilage
Yak Posting Veteran

82 Posts

Posted - 2014-09-12 : 11:56:56

Thank you! I thought I tried that. I guess I didn't

quote:
Originally posted by Arun Babu N

Select sum(cast([Claim] as int)) from Table


Arun Babu N

Go to Top of Page
   

- Advertisement -