SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


What Do You Call This Relationship ?


What Do You Call This Relationship ?

Author
Message
homebrew01
homebrew01
SSCarpal Tunnel
SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)

Group: General Forum Members
Points: 4771 Visits: 9108
I have a situation with items that are related, but not really in a heirarchy ... more like parent to parent. As shown below, all the ODD numbers are related to each other equally so that '1' is related to '11' via the other entries. ie, 5 is related to 1, and 11 is related to 5, therefore 11 is related to 1.

And all the EVEN numbers are related to each other equally, so that '12' is related to '2' because 12 is related to 10, 10 is related to 8, and 8 is related to 2.

I need to consolidate related rows into 1 summary row (selecting oldest & newest dates), and looking for examples on the InterWebz, but not sure what keywords I should be looking for to describe this kind of relationship.


Item_A   Item_B
5 1
6 4
7 3
8 2
9 7
10 6
10 8
11 5
11 9
12 10





MMartin1
MMartin1
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2717 Visits: 2031
With the ODD numbers, how is 7,5,3 related. Did you miss 7 is related to five?
thanks

----------------------------------------------------
How to post forum questions to get the best help
Eugene Elutin
Eugene Elutin
SSCarpal Tunnel
SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)

Group: General Forum Members
Points: 4960 Visits: 5478
It's a tree or hierarchy, whatever you prefer.
I guess, you will need to use some sort of recursive CTE. Hard to say anything more based on provided limited details.

_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search