Results 1 to 3 of 3

Thread: Row filters

  1. #1
    Join Date
    Jan 2010
    Posts
    64

    Exclamation Unanswered: Row filters

    There is a table TEST which has two columns
    COLA COLB
    101 A
    101 B
    101 C
    102 B
    102 A
    103 A
    103 B

    i want to fetch only those cola records for which there is no colb = 'C'.

    The final result should contain
    102 B
    102 A
    103 A
    103 B

    no records for 101 should appear.

    please advice.....

    cheers!
    subhotech

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    SELECT cola
         , colb
      FROM test AS t
     WHERE NOT EXISTS
           ( SELECT 'uh oh'
               FROM test
              WHERE cola = t.cola
                AND colb = 'C' )
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2010
    Posts
    64

    Mnay Many Thanks!

    Mnay Many Thanks!

Posting Permissions

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