× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



>From: Vernon Hamberg [mailto:vhamberg@attbi.com]
>I believe (may be wrong) that this subselect is run repeatedly...
>Select * from item_master
>where vendor in (select vnd
>                         from vndmst
>                         where crt_date = current_date)

You're 1/2 right and 1/2 wrong. Correlated subqueries are rerun for each
row, but they have to be. A correlated subquery is one where the records
selected in the subquery depend on a value in the row being evaluated in the
main query. However, non-correlated sub queries should only be run once for
the entire statement. If this is not the case it's a bug in the SQL
optimizer and should be reported to IBM. In the case above the 'in'
predicate select will only be evaluated once since the results don't depend
on any values in the main select. Had the select been

Select * from item_master
where vendor in (select vnd
                         from vnditm
                         where vnditm.itm = item_master.itm)

Where the idea was to select all the rows in item_master where the vendor on
the item was listed as a vendor that sold that item in the vnditm file then
that subselect would be reevaluated each time. (Granted this would be a
stupid way to get this result set)

-Walden

------------
Walden H Leverich III
President
Tech Software
(516) 627-3800 x11
(208) 692-3308 eFax
WaldenL@TechSoftInc.com
http://www.TechSoftInc.com



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.