If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > SQL Query...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-20-04, 04:54
Corso Corso is offline
Registered User
 
Join Date: Aug 2004
Posts: 5
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
Reply With Quote
  #2 (permalink)  
Old 12-20-04, 05:40
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
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.
Reply With Quote
  #3 (permalink)  
Old 12-20-04, 08:16
Corso Corso is offline
Registered User
 
Join Date: Aug 2004
Posts: 5
you are right!! it's what i want!
thank you!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On