Two records a year apart

From: Philip Morrow <cracker_at_mymorrow.com>
Date: Tue, 15 Jan 2002 16:41:09 GMT
Message-ID: <FYY08.319756$oj3.65752308_at_typhoon.tampabay.rr.com>



[Quoted] I've got a table similar to this

mperiod date
mstore number
tc number
tq number
tp number
comp number

I'm using this SQL to determine if, for any one record of say store 154 if [Quoted] there is a corisponding record for that store one year prior. It seems to [Quoted] be taking a long time... any suggestions on a different way to do this would [Quoted] help, or suggestions on a better way to write this SQL would help too.

The explain plan lists two full table accesses.

update mcd.sumps a set a.comp = 1 where a.mstore in (

    select b.mstore from mcd.sumps b where (to_date(a.mperiod) - to_date(b.mperiod)) = 365); Received on Tue Jan 15 2002 - 17:41:09 CET

Original text of this message