Home » SQL & PL/SQL » SQL & PL/SQL » Rewrite this query
Rewrite this query [message #328714] Sun, 22 June 2008 03:01 Go to next message
balaji23_d
Messages: 123
Registered: February 2007
Senior Member
Hi all,

please any one can rewrite this query to simplify it..
select uabscon_number,uabscon_cust_code,uabscon_prem_code from uabscon 
where  (uabscon_cust_code,uabscon_prem_code)
not in(select c_cust,c_prem from 
(select A.min_rank, A.c_cust, A.c_prem, A.c_srvc,(select MIN(p.ucrprod_srvc_code)
 from utvsrvc r, ucrprod p 
where p.ucrprod_cust_code=A.c_cust
and p.ucrprod_prem_code=A.c_prem
and p.ucrprod_srvc_code = r.utvsrvc_code
and r.UTVSRVC_RANKING = A.min_rank) srvc_code, 
(select uabscon_srvc_code from uabscon 
where uabscon_cust_code=A.c_cust 
and uabscon_prem_code=A.c_prem) srvc_code_uaxfrom
 ( select (select min(r.utvsrvc_ranking) from utvsrvc r,ucrprod p
where p.ucrprod_cust_code = c.uabscon_cust_code
and p.ucrprod_prem_code = c.uabscon_prem_code 
and p.ucrprod_srvc_code = r.utvsrvc_code ) min_rank,
c.uabscon_cust_code c_cust, c.uabscon_prem_code c_prem, c.uabscon_srvc_code c_srvc
from uabscon c 
where c.uabscon_status_ind <>'C') A )B 
where srvc_code = srvc_code_uax ) and uabscon_status_ind <>'C'
Re: Rewrite this query [message #328715 is a reply to message #328714] Sun, 22 June 2008 03:26 Go to previous messageGo to next message
Michel Cadot
Messages: 64145
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please can you first format your query.

Regards
Michel
Re: Rewrite this query [message #328716 is a reply to message #328715] Sun, 22 June 2008 03:37 Go to previous messageGo to next message
balaji23_d
Messages: 123
Registered: February 2007
Senior Member
Hi,

find the attached the sql script with this thread.
  • Attachment: query.sql
    (Size: 1.78KB, Downloaded 108 times)
Re: Rewrite this query [message #328717 is a reply to message #328714] Sun, 22 June 2008 03:44 Go to previous message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
Check this link for more information.

http://forums.oracle.com/forums/thread.jspa?threadID=672459&tstart=0

For me both these questions look the same and I presume OP to be the same individual.

Regards

Raj

P.S : @Op, I don't understand why you start the same question in this forum without giving enough information like you did in the other forum.
Previous Topic: ORA-01438
Next Topic: Data from table having BFILE column
Goto Forum:
  


Current Time: Fri Dec 09 11:55:09 CST 2016

Total time taken to generate the page: 0.05989 seconds