Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2007

    Unanswered: Returning Matching/Non matching Records

    Hi All

    I have a strange request that might not be possible based on the laws of relational databases but I thought I'd give it a try.

    I have three tables which for simplicity I will call A, B and C. Table A contains my master records, Table B contains user details and the final table contains some extra data

    In my initial search when joining A and B, I return 100 records. I then need to search in table C for these 100 records based on a criteria. the expected result should return all 100 rows for the ones that match and also the ones that do not match. The problem is that in Table C, not all the 100 IDs exist, so there will not be a corresponding record. Unfortunately, our users still want to see all 100 records in the output. Is this possible

    As always any help or direction would be appreciated.

  2. #2
    Join Date
    Nov 2004
    on the wrong server
    Provided Answers: 6
    read brett's sticky...

    ddl? sample data? do you have some code already?
    “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.

  3. #3
    Join Date
    Apr 2002
    Toronto, Canada
    Quote Originally Posted by ejazzy
    Is this possible
    you betcha!!

    hint: A inner join B left outer join C | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Oct 2006
    it's possible, study more on the left join right join and inner join

  5. #5
    Join Date
    Feb 2007
    Thanks for the responses guys. I was actually doing this on behalf of a friend who I was awaiting some ddl from. He now reports that he's been able to resolve his issue. Thanks.

  6. #6
    Join Date
    Jan 2007
    Provided Answers: 12
    Someone correct my method please...

    I would have created 2 queries - one with IN and the other using a NOT IN criteria...

    then unioned them...

    If you get me
    Home | Blog

Posting Permissions

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