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 2005 Forums
 Transact-SQL (2005)
 Help! A cluster method in SQL

Author  Topic 

mavershang
Posting Yak Master

111 Posts

Posted - 2008-11-26 : 10:56:07
Hi guys, I have a question of cluster method in SQL.

A table contain 3 columns: rownumber, name, value.
I want to cluster the rows according to their values.

Step 1: First I create another table (tracking table), randomly put some
rows from the data table into this tracking table as the seeds.

Step 2: Then I want to calculate the (ith_value_from_datatable - jth_value_
from_trackingtable)**2, and assign ith row of data table into the jth group
according the the smallest distance calculated above.

Step 3: Then update the tracking table by calculating the new average of jth
group value.
Go back to step 2 until ............

So the question is about how to do that cycle in two tables.

I am really new to SQL and not familiar with SQL code. Could anyone help me
out of this question?

Thanks a lot.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-26 : 10:59:39
Some sample data and expected output would really help.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

mavershang
Posting Yak Master

111 Posts

Posted - 2008-11-26 : 11:05:14
Sample data as:
rownumber name value
1 FDD 1.21
2 TR 2.6
...............

I do not really care the forms of expected output, it could be like
a table containing 2 columns as
group_name rownumber
1 2
1 5
1 20
2 4
2 30
.......
other output forms are also acceptable

Thanks


quote:
Originally posted by Peso

Some sample data and expected output would really help.



E 12°55'05.63"
N 56°04'39.26"


Go to Top of Page
   

- Advertisement -