SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 count and update
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

skativarapu
Starting Member

13 Posts

Posted - 07/18/2006 :  16:17:05  Show Profile  Reply with Quote
I have a table in which has 1300 rows and a colum has 800 unique values,100 twice repeated values and 100 3times repeated values.

now i have added a new column which would have 1's and 0's
1 for each unique entery and 0 for every second or 3rd entery

so that when i sum it up it should give 1000 -- SUM(column)=1000

Srinika
Flowing Fount of Yak Knowledge

Sri Lanka
1378 Posts

Posted - 07/18/2006 :  16:28:42  Show Profile  Reply with Quote
quote:
Originally posted by skativarapu


now i have added a new column which would have 1's and 0's
1 for each unique entery and 0 for every second or 3rd entery



This u do for some purpose ? if so what is it?

quote:
Originally posted by skativarapu
so that when i sum it up it should give 1000 -- SUM(column)=1000


What do u want to be done ?
To find the # of unique values (ie. considering the repeated as 1) ?


Srinika
Go to Top of Page

skativarapu
Starting Member

13 Posts

Posted - 07/18/2006 :  16:46:19  Show Profile  Reply with Quote
consider the repeated as one so that that will give me the count of unique for my report in the warehouse to use that column in microstrategy for counting
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

USA
7020 Posts

Posted - 07/18/2006 :  17:01:02  Show Profile  Reply with Quote
If the sum is all you are after, you can get that without adding a column to the table.

select
	count( distinct MyColumn )
from
	MyTable


CODO ERGO SUM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000