>Does it has to be in one select? E.g. say, can you select all your operators first, then check, if their routes and dates match the interval?
Well there are thousands of recs in the ET table, and their dates can vary, so each rec has to be checked at read time to get its SERVETYPE from RteFam (Route Family). One Serve Type could expire mid-month and be replace with a different scheme, for the same route.
Anyhow, the SQL is taking too long (and esp. since I have to add the "infinite" clauses) so I think I'll need to pre-SQL it into an array and use this in a look-up function instead.
>
>Also please apply Fabio's suggestion to this select before anyone can proceed making any sense of it.
>
Whatever, I don't think that these detract from the "sense" of the SQL, but I'll need to look into that, for sure. BTW, have you ever looked at some of the complex SQL you often post, with crammed up text and no formatting or indenting? I find them almost impossible to read.
>>
...
>>
>>Essentially it's (should be) saying "If there is a matching operator/route combo, in the RteFam table, well if it's dates are current with the ET rec's date, use its SERVTYPE field - else put a '#' (to denote out-of-date). If there is no match, put a '?' to denote 'not known'"
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.