Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313

    Unanswered: finding completely overlapping segments

    ok folks, I need help.

    Here's the table and some sample data:

    Code:
    declare @t table 
    (
      segment int, 
      subsegment int, 
      primary key (segment,subsegment)
    )
    insert @t 
    select 1,33 union all 
    select 1,22 union all
    select 2,33 union all
    select 2,22 union all
    select 3,33 union all
    select 3,22 union all
    select 3,44
    What I want is to find all segments that are in some sense complete duplicates of other segments. a segment is made up of subsegments. a subsegment is not a segment - it's a completely different entity. this table is not hierarchical.

    So in the sample data above, segments 1 and 2 are dupes because they share exactly the same subsegments: 22 and 33. Segment 3 is not a dupe because it has a third subsegment the other two don't have: 44.

    when a duped segment is found, I need to know which other segment it duplicates. so an acceptable result set for the above sample data would be:

    Code:
    segment   partner
    -------   -------
    1         2
    this would also be fine:

    Code:
    segment   partner
    -------   -------
    1         2
    2         1

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    wow, sqlteam rocks.

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=104300

    no hard feelings, dbforums.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Well, sure. We let them handle the easy questions...
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    You didn't suffix your question with "- URGENT!!!11". I don't waste my time on any threads that aren't URGENT!!!11.

  5. #5
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    I'll do better next time.

    and no more easy questions:

    URGENT! - plz how to sovle knapsack poblem in sql - boss is yelling me!

  6. #6
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    Quote Originally Posted by jezemine
    wow, sqlteam rocks.

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=104300

    no hard feelings, dbforums.
    if I were Pat I would suspend your account.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Let it be noted that you posted this when us Brits were all tucked up in bed meaning that you're answer was still another few Zs away; hardly a fair contest!
    George
    Home | Blog

  8. #8
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    excuses, excuses...

  9. #9
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    excuse me Mr Original Poster, will you please not cross post.
    Last edited by Thrasymachus; 06-06-08 at 14:40.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  10. #10
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    I had to cross post, because I didn't get a response on this thread within 30 seconds!

  11. #11
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    While it is true that we responded to your post much LATER than sqlteam did, I must point out that we are responding to your post much LONGER than sqlteam did. In terms of pure verbosity and tenacity, they do not hold a candle to dbforums.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  12. #12
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    Quote Originally Posted by blindman
    In terms of pure verbosity and tenacity, they do not hold a candle to dbforums.
    Of note is that in all that verbosity, not a bit of it contains anything in the way of a TSQL statement!


  13. #13
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Code:
    select 'Hello World!'

  14. #14
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    thanks for suggestion. but it don't work:

    Code:
    c:\>select 'Hello World!'
    'select' is not recognized as an internal or external command,
    operable program or batch file.

  15. #15
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    I have told you guys over and over giving a computer to jez is like giving an abacus to a dog .
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •