Results 1 to 3 of 3

Thread: SQL Query...

  1. #1
    Join Date
    Aug 2004
    Posts
    5

    Unanswered: SQL Query...

    I want a SQL script ...this is the problem...
    I have 2 column NAME AND TEST as like:

    NAME;TEST
    !E ;104
    D ;104
    $B ;106
    !E ;106
    D ;106
    !E ;119
    $B ;119
    $V ;119

    I wont retrive all record without NAME = D and without the same test number

    RESULT LIKE:
    NAME;TEST
    !E ;119
    $B ;119
    $V ;119

    this query is WRONG:
    SELECT NAME , TEST
    FROM TABLE
    WHERE (NAME) Not Like ("D");

    you can help me?
    thanks

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    You didn't exclude "the same test number" condition. What does it mean, anyway? "same" as what? Any test number that appears under "D" name? If so, this code might solve your problem:
    Code:
    SELECT NAME, TEST
      FROM my_table
     WHERE NAME <> 'D' 
       AND TEST NOT IN (SELECT TEST
                        FROM my_table
                        WHERE NAME = 'D');
    P.S. You didn't mention your SQL engine; I hope this Oracle SQL code will work on your system too.

  3. #3
    Join Date
    Aug 2004
    Posts
    5
    you are right!! it's what i want!
    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
  •