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
 Transact-SQL (2000)
 linked numbers

Author  Topic 

marat
Yak Posting Veteran

85 Posts

Posted - 2006-05-18 : 00:08:39
Hi all
I have table <tbl1>
col1 col2
1 2
2 3
3 4
5 10
7 10
I need output in table <tbl2> to look like
col1 col2
1 2
1 3
1 4
5 7
5 10
What would be a solution for this task?
Thanks

PSamsig
Constraint Violating Yak Guru

384 Posts

Posted - 2006-05-18 : 01:14:28
First of, please tell what the correlation is between these two tables, I for one fail to see it ...

-- This one's tricky. You have to use calculus and imaginary numbers for this. You know, eleventeen, thirty-twelve and all those.
Go to Top of Page

marat
Yak Posting Veteran

85 Posts

Posted - 2006-05-18 : 01:34:55
These are references of duplicate records.
Thanks
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-05-18 : 01:41:57
what do you mean by References of duplicate records?? can you be more clear

If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

marat
Yak Posting Veteran

85 Posts

Posted - 2006-05-18 : 02:40:20
OK,
Say I have a table <tbl1>
col1 col2 col3 ...colN
......................
......................
where col1 is URN
I want produce a table <tbl2>
colA colB
.........
.........
populated with references of duplicate records
from tbl1 on fields, say col5, col11, col25
where colA would be a master URN(min URN for the set of dupes) and colB would be a URN of duplicate record.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-05-18 : 05:38:00
quote:
I have table <tbl1>
col1 col2
1 2
2 3
3 4
5 10
7 10


quote:
Say I have a table <tbl1>
col1 col2 col3 ...colN
......................
......................
where col1 is URN
I want produce a table <tbl2>
colA colB


Is the source table only 2 column or multiple column ?


KH

Go to Top of Page

marat
Yak Posting Veteran

85 Posts

Posted - 2006-05-18 : 08:42:08
Let's start again
I have table <tbl1>
col1 col2
1 2
2 3
3 4
5 10
7 10
In tbl1 I have col1 is equivalent to col2 relationship
I need output in table <tbl2> to look like
col1 col2
1 2
1 3
1 4
5 7
5 10
Rules are: If 1==2 and 2==3 and 3==4 ==> 1==2 and 1==3 and 1==4
If 5==10 and 7==10 ==> 5==10 and 5==7.

Or in graphics: ---> is a LINK or EQUIVALENT

A--->B--->C = A--->B and A--->C if A<B and A<C
A--->B--->C = C--->A and C--->B if C<A and C<B
A--->B--->C = B--->A and B--->C if B<A and B<C


A--->B
= A--->B and A--->C if A<B and A<C
C--->B

That's all I can tell.
Thanks


Go to Top of Page
   

- Advertisement -