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!

Including field indicator

706041Aug 5 2009 — edited Aug 5 2009
I have a requirment similar to following


select * from emp where deptno=10

List 3 rows

I want to include an indicator DEPT_IND with values 'Y' or 'N' for these 7 rows ,
DEPT_IND has a value 'Y' when the row returned by the above query has an enrty for the condition deptno=20 in the emp table .


How can I include this in the query

sample table data.
emp

empno ename deptno
121	xxx	10
121     xxx	20
123	yyy	10	
124     zzz	10

I should get the o/p as

empno ename DEPT_IND
121    xxx	Y        
123    yyy	N
124    zzz	N
Thanks for your help.

Hena.
This post has been answered by Beijing on Aug 5 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2009
Added on Aug 5 2009
5 comments
583 views