Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    28

    Unanswered: comparing two lists

    Lets say I have 3 "lists" (by which I mean columns resulting from a select statement):

    List 1:
    a
    b
    c
    d

    List 2:
    a
    b
    c
    d
    e
    f

    Can I return:

    List 3
    e
    f

    (i.e. all the records which are in list 2 but not in list 1). It seems strange that I cannot do this.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    yep, with a LEFT OUT JOIN
    Code:
    select x
      from ( select  statement ) as list2
    left outer
      join  ( select  statement ) as list1
        on list1.x = list2.x
     where list1.x is null
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    As R937 said, Yes.

    -PatP

Posting Permissions

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