MySQL Forums
Forum List  »  Optimizer & Parser

where condition optimization
Posted by: Srivats Chandrasekaran
Date: February 27, 2006 03:57AM

select
a.nb_group_name as nb_group_name,
master.nb_coupon as nb_coupon,
sum(info.value ),
sum(info3.value),
sum(info6.value),
sum(info12.value),
nb_pool_info info,
nb_pool_info info3,
nb_pool_info info6,
nb_pool_info info12,
AGENCY_MASTER.nb_pool_type_master a,
nb_seller_master seller
where
a.nb_group_name = 'FHCI' and
a.nb_pool_type = master.nb_pool_type and
master.nb_pool_number = info.nb_pool_number and
master.nb_seller_code = seller.nb_seller_code and
seller.nb_seller_name <> 'FREDDIE MAC GIANT' and
info.nb_factor_date = '20041201' and info3.nb_factor_date = date_add('20041201', INTERVAL -3 MONTH ) and
info6.nb_factor_date = date_add('20041201', INTERVAL -(3*2) MONTH ) and
info12.nb_factor_date = date_add('20041201', INTERVAL -(3*4) MONTH ) and
info.nb_pool_number = info3.nb_pool_number and
info.nb_pool_number = info6.nb_pool_number and
info.nb_pool_number = info12.nb_pool_number and
info.nb_sched_balance > 0
GROUP BY
a.nb_group_name,
master.nb_coupon

in this query suppose i dont have records corresponding to info12.nb_factor_date i am getting an empty set as the where condition is failing. Is there any way i get the data corresponding to other dates and null for the dates i dont have the values. For example if i dont have values corresponding to info12.nb_factor_date then i should get null only for only those values and not an emply set.

Options: ReplyQuote


Subject
Views
Written By
Posted
where condition optimization
3008
February 27, 2006 03:57AM
1809
April 19, 2006 02:26AM
1815
April 19, 2006 09:51AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.