Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Data Select based on 2 columns

632265Jun 4 2010 — edited Jun 4 2010
Hi

I have table like this ,
Version: 

Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production
PL/SQL Release 9.2.0.5.0 - Production
CORE	9.2.0.6.0	Production
TNS for 32-bit Windows: Version 9.2.0.5.0 - Production
NLSRTL Version 9.2.0.5.0 - Production
CREATE TABLE EMPSELECT( EMP NUMBER , CAR1 CHAR(2),CAR2 CHAR(2) );

INSERT INTO EMPSELECT VALUES( 100 ,   'XX',    'YY');
INSERT INTO EMPSELECT VALUES( 100 ,   'CC',    'YY');
INSERT INTO EMPSELECT VALUES( 100 ,   'CS',    'XX');
INSERT INTO EMPSELECT VALUES( 101 ,   'XX',    'YY');
INSERT INTO EMPSELECT VALUES( 102 ,   '2X',    'YY');
INSERT INTO EMPSELECT VALUES( 102 ,   'SS',    'Y2');
INSERT INTO EMPSELECT VALUES( 103 ,   'RR',    'XX');
INSERT INTO EMPSELECT VALUES( 103 ,   'RC',    'XX');
INSERT INTO EMPSELECT VALUES( 103 ,   'CC',    'CS');
INSERT INTO EMPSELECT VALUES( 101 ,   'TC',    'XX');
INSERT INTO EMPSELECT VALUES( 109 ,   'TC',    'FF');
I would like to select Emp records where XX not present in the two columns CAR1,CAR2 If find 1 row containing XX

OUTPUT:
Emp
102
109

Thanks
Ananda

Edited by: Ananda on Jun 4, 2010 4:19 PM

Edited by: Ananda on Jun 4, 2010 4:20 PM
This post has been answered by 009 on Jun 4 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 2 2010
Added on Jun 4 2010
9 comments
1,350 views