Home » SQL & PL/SQL » SQL & PL/SQL » select get
select get [message #231133] Sat, 14 April 2007 21:27 Go to next message
oracle_coorgi
Messages: 185
Registered: September 2006
Location: INDIA-karnataka
Senior Member
HI
i need to get all the FK_proj_ID if any of the rep_status='N'
get all the records other then 10017 because it doesnot have rep_status='N'
i need to get total 9 records for FK_proj_ID 10015,10016,10018 three records for each FK_proj_ID

 select * from rep; 
 PK_REP_ID FK_PROJ_ID FK_REP_CAT_ID REP_STATUS
---------- ---------- ------------- - 
       100      10015          2001 N
       101      10015          2002 Y
       102      10015          2003 Y
       103      10016          2001 Y
       104      10016          2002 N
       105      10016          2003 Y
       106      10017          2001 Y
       107      10017          2002 Y
       108      10017          2003 Y
       109      10018          2001 N
       110      10018          2002 N
       111      10018          2003 Y

[Updated on: Sat, 14 April 2007 21:46]

Report message to a moderator

Re: select get [message #231134 is a reply to message #231133] Sat, 14 April 2007 21:46 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
select * from rep where FK_proj_Id <> 10017

Re: select get [message #231136 is a reply to message #231134] Sat, 14 April 2007 22:24 Go to previous messageGo to next message
oracle_coorgi
Messages: 185
Registered: September 2006
Location: INDIA-karnataka
Senior Member
hi
if there r thousands of records then i will not know which fk_proj_id is not having rep_status 'N'
its just an example
if i use union and count then ...

[Updated on: Sat, 14 April 2007 22:25]

Report message to a moderator

Re: select get [message #231138 is a reply to message #231133] Sat, 14 April 2007 22:49 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
from http://www.orafaq.com/forum/t/59966/74940/

7. Show us what you did (if you tried it yourself), including errors and/or why the result is not what you want.
Re: select get [message #231139 is a reply to message #231138] Sat, 14 April 2007 22:59 Go to previous messageGo to next message
oracle_coorgi
Messages: 185
Registered: September 2006
Location: INDIA-karnataka
Senior Member
hi
thanxs
Re: select get [message #231140 is a reply to message #231139] Sat, 14 April 2007 23:22 Go to previous message
muzahid
Messages: 281
Registered: September 2004
Location: Dhaka, Bangladesh
Senior Member
select * from rep where FK_PROJ_ID in
(
select distinct FK_PROJ_ID from rep where REP_STATUS ='N'
)
Previous Topic: SUM function..??
Next Topic: non-key preserved
Goto Forum:
  


Current Time: Sat Dec 03 03:40:59 CST 2016

Total time taken to generate the page: 0.04605 seconds