[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Report uses all resources
Mark -
What you almost certainly want to do is:
begin-select
.. . .
from
workorder wo
where
exists ( select 'x' from labor l where l.wo_num = wo.num ) or
exists ( select 'x' from materials m where m.wo_num = wo.num ) or
exists ( select 'x' from services s where s.wo_num = wo.num )
end-select
When ever you say to yourself "I want those X that have a/some Y" you
probably want an exists clause.
There is another, more complicated, way of doing this with outer joins,
but walk before you fly. Nature's rule not Mr. Miagi's.
Hope this helps,
Eric
On Tue, 25 Nov 1997, Mark Capaldi wrote:
> Probably should have explained a bit more. We are using SQLBase and NT
> Server. What the main select is suppose to do is select a workorder where
> there has been materials, and/or labor, and/or services charged to it
> within the date range input by the user. There isn't a date field common
> between the tables. For example, if there is a workorder that has labor and
> materials charged to and the transaction dates from the labor table and
> matusetrans table are within the input dates the 'select' would grab it.
>
> Hope this clarifies it! :)
>
> Mark
>
------------------------------------------------------------------------
Eric Eastman | Ray Ontko & Co. | Adverbs are endangered; act quickly.
erice@ontko.com | Richmond, IN | http://www.ontko.com/, ftp.ontko.com