Results 1 to 7 of 7

Thread: outer join

  1. #1
    Join Date
    May 2003
    Posts
    70

    Unanswered: outer join

    Hello,

    I need to do the following.
    I want to select all records from one table that satisfy a certain criteria. Easy enough. I also want records from another table related to the first table that only satisfy certain criteria as well. I used an outer join, but when specifying the where clause on the second table's fields, it affects the first table's records.

    How can I get all records from the first table and only ones from the second that satisfy the where clause?

    Thanks,

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    simple

    just move the conditions for the right table from the WHERE clause into the ON clause of the join

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    show an example of what your trying and we'll show you where your going wrong
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by m.timoney
    show an example of what your trying and we'll show you where your going wrong
    i already explained what was wrong

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    you did, and i'm saying if they want a more specific answer then we need a more specific question
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you could say that after almost every thread on here where the question is answered simply, without actual templates of code
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    May 2003
    Posts
    70
    r937's answer was sufficient. Thank You.

Posting Permissions

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