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
 SQL Server Development (2000)
 help with creating table defining co relation

Author  Topic 

ashley.sql
Constraint Violating Yak Guru

299 Posts

Posted - 2006-08-14 : 21:11:38
I want to create a table which has co-relation among one column ID

Say I have values in a column A, B, C, D, E, and F

there is this relation between them

A B C D E F
A 1 3 4 5 2 7
B 1
C 1
D 1
E 1
F 1

This means co-relation between A, B is 3
A,C is 4
A, D is 5
A, E is 2 and so on.

So how would i create a table like this and I should be able to select the maximum or minimum correlation according to requeirement from a group of correlations.

like from the above data minimum is A,E = 2
and maximum is A, D = 5

there will be other groups like B, C and C,E and C,D and E,F will also be there and will have a corelation between them.

Ashley Rhodes

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-08-14 : 23:03:37
WTF???






CODO ERGO SUM
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-15 : 03:39:55
Create a table with three columns. First column is the "from group", second column is "to group" and the third column is the co-relation between the two groups. Keep the data normalized.

Then just add data as needed and select with
select	[third column]
from [my table]
where [first column] = 'a' and [second column] = 'e'
or [first column] = 'e' and [second column] = 'a'


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-15 : 03:43:28
quote:
Originally posted by Michael Valentine Jones

WTF???
Is it dead, Michael?

Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -