Need help for query tunning the below query [message #531577] |
Wed, 16 November 2011 20:50 |
|
shefalik
Messages: 3 Registered: November 2011
|
Junior Member |
|
|
how to write this inner query filter cond in efficent way
select from
where
.....
and (
( pcsc.initial_date is null
and
not exists
(select STUD_CPNT_ID
from pa_cbt_stud_cpnt
where cpnt_id=pcsc.cpnt_id
and stud_id=pcsc.stud_id
and initial_date is not null
)
)
or
pcsc.initial_date =
(
select min(initial_date)
from pa_cbt_stud_cpnt
where cpnt_id=pcsc.cpnt_id
and stud_id=pcsc.stud_id
--and nvl(cmpl_stat_id,0)=nvl(pcsc.cmpl_stat_id,0)
)
)
[Updated on: Wed, 16 November 2011 20:56] Report message to a moderator
|
|
|
|
|
|
|
Re: Need help for query tunning the below query [message #531639 is a reply to message #531602] |
Thu, 17 November 2011 03:38 |
cookiemonster
Messages: 13958 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Efficient ways of writing queries depend on table structures, relationships between them, indexes and ammount of data (in total and to be retirieved) amongst other things.
We simply can not suggest better alternatives to the snippet you've given with no context.
|
|
|