Hi All,
Below is my script, I need to find the avg no tot_offers made between the 2 dates as per my subselect, I cannot use the b. and a.vev_event in the subselect, any ideas?
SELECT AVG (TO_DATE (b.vev_event_date) - TO_DATE (a.vev_event_date)) aver,
MAX (TO_DATE (b.vev_event_date) - TO_DATE (a.vev_event_date)) maxi,
MIN (TO_DATE (b.vev_event_date) - TO_DATE (a.vev_event_date)) mini,
AVG (tots.totoffs)
FROM properties,
property_elements,
void_instances,
void_events a,
void_events b, (select oof_pro_refno, count (*) totoffs from organisation_offers where oof_offer_date between
b.vev_event_date and a.vev_event_date
group by oof_pro_refno) tots
WHERE pro_refno = pel_pro_refno(+)
AND pel_ele_code = 'NOBD'
AND pel_numeric_value = 0
AND pel_pro_refno = vin_pro_refno(+)
AND vin_refno = a.vev_vin_refno(+)
AND a.vev_evt_code = 'VOID'
AND vin_refno = b.vev_vin_refno(+)
AND b.vev_evt_code = 'LET'
AND vin_status_start BETWEEN '01-APR-2003' AND '01-APR-2004'
AND a.vev_event_date BETWEEN '01-APR-2003' AND '01-APR-2004'
and vin_pro_refno = tots.oof_pro_refno
ORDER BY pro_propref
Many thanks
Sam
Below is my script, I need to find the avg no tot_offers made between the 2 dates as per my subselect, I cannot use the b. and a.vev_event in the subselect, any ideas?
SELECT AVG (TO_DATE (b.vev_event_date) - TO_DATE (a.vev_event_date)) aver,
MAX (TO_DATE (b.vev_event_date) - TO_DATE (a.vev_event_date)) maxi,
MIN (TO_DATE (b.vev_event_date) - TO_DATE (a.vev_event_date)) mini,
AVG (tots.totoffs)
FROM properties,
property_elements,
void_instances,
void_events a,
void_events b, (select oof_pro_refno, count (*) totoffs from organisation_offers where oof_offer_date between
b.vev_event_date and a.vev_event_date
group by oof_pro_refno) tots
WHERE pro_refno = pel_pro_refno(+)
AND pel_ele_code = 'NOBD'
AND pel_numeric_value = 0
AND pel_pro_refno = vin_pro_refno(+)
AND vin_refno = a.vev_vin_refno(+)
AND a.vev_evt_code = 'VOID'
AND vin_refno = b.vev_vin_refno(+)
AND b.vev_evt_code = 'LET'
AND vin_status_start BETWEEN '01-APR-2003' AND '01-APR-2004'
AND a.vev_event_date BETWEEN '01-APR-2003' AND '01-APR-2004'
and vin_pro_refno = tots.oof_pro_refno
ORDER BY pro_propref
Many thanks
Sam