Re: Dumb question--between/and
Posted in 1994
Topics: General Discussion
In <355eae$sqr@emory.mathcs.emory.edu> holly_gordon@tsl.texas.gov ("Holly Gordon") writes:
>Can someone tell me what is wrong with this between clause? Seems to cause a
>long transaction, which aborts--
>Select author from marc
>where creation_date between "19930901*" and "19940831*" and
>title_id in (select title_id from item where agency_id = "TNR")
>end
To avoid reading thee table item for each selected row of marc try the following
select title_id from item where agency_id = "TNR" into temp tmptab;
select author from marc where creation_date > "19930901" and creation_date
< "19940831" and title_id in ( select title_id from tmptab);
drop table tmptab;
This sould probably not cause a long transaction because in the created temp
table you have only one column. I dont know if the select by <> is faster or
easier (try it with "set explain on").
I am interested in the result. So if you try that SQL-script please post or
mail the result.
Peter