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.
| 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 somerows 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 groupaccording the the smallest distance calculated above.Step 3: Then update the tracking table by calculating the new average of jthgroup 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 meout 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" |
 |
|
|
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 likea table containing 2 columns asgroup_name rownumber 1 2 1 5 1 20 2 4 2 30.......other output forms are also acceptableThanksquote: Originally posted by Peso Some sample data and expected output would really help. E 12°55'05.63"N 56°04'39.26"
|
 |
|
|
|
|
|