Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2011
    Posts
    25

    Unanswered: Peculiar requirement for writing sql

    In a table we have
    examination id |Profile id as two columns

    101| 20
    105| 20
    100| 23
    101| 23
    100| 29
    101| 29
    106| 30
    107| 30
    101| 30
    105| 44
    108| 44
    105| 45
    108| 45
    here exam id 100 and 101 are repeated for profile 23 and 29 but not for profile id for 20 and 30. So in our output 23 and 29 will appear and not 20 and 30.
    Similarly 44 and 45 are duplicates and it should appear in the output

    Out put will be :
    row 1: 23, 29
    row 2: 44, 45
    Can it done using a sql query in DB2.
    Last edited by pp8771; 04-03-17 at 09:08.

  2. #2
    Join Date
    Oct 2007
    Posts
    153
    Provided Answers: 9
    I would suggest you stay with the one thread you already have open on this topic.

    http://www.dbforums.com/showthread.p...rent-Duplicate

  3. #3
    Join Date
    Nov 2011
    Posts
    25
    Thanks . But i required the query for this requirement. cannot mix with previous requirement

  4. #4
    Join Date
    Nov 2011
    Posts
    25
    can any one help me here?

  5. #5
    Join Date
    Jul 2016
    Location
    Moscow
    Posts
    260
    Provided Answers: 39
    What output do you expect from the following data, for example?

    100| 23
    101| 23
    102| 23

    100| 29
    101| 29
    102| 29

    100| 30
    101| 30

    100| 31
    102| 31
    Regards,
    Mark.

  6. #6
    Join Date
    Nov 2011
    Posts
    25
    Thanks Mark.
    I am re writing the issue.

    In a table we have
    examination id |Profile id as two columns

    101| 20
    105| 20
    100| 23
    101| 23
    100| 29
    101| 29
    106| 30
    107| 30
    101| 30
    105| 44
    108| 44
    105| 45
    108| 45
    here exam id 100 and 101 are repeated for profile 23 and 29 but not for profile id for 20 and 30. So in our output 23 and 29 will appear and not 20 and 30.
    Similarly 44 and 45 are duplicates as it has same examination id as 105 and 108 and it should appear in the output

    Out put will be :
    row 1: 23, 29
    row 2: 44, 45

    Can it done using a sql query in DB2.
    Last edited by pp8771; 04-05-17 at 05:25.

  7. #7
    Join Date
    Oct 2007
    Posts
    153
    Provided Answers: 9
    I gave you an outline for this in your other post. Again, what have you tried so far for us to point you in the right direction? This forum is for help and assistance, not for doing class work for you.

    Dave

Posting Permissions

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