> From: hammerin hankster
> FROM tblMasterClients, tblbillingaddr, tbllegaladdr
>
> where tblmasterclients.clientname = tbllegaladdr.legalname
>
> and tblmasterclients.acctstatus = 'A'
> OR tblmasterclients.acctstatus = 'ACT'
It might help if you can post a relationships screen capture. However, don't send it to the list, because attachments aren't allowed.
However, looking at the pieces of the query I quoted above (and without knowing the relationships) . . .
1) You have 3 tables, but are only joining two of them. That means you're going to get a row back for every single row that exists in tblbillingaddr (a cross join). If that's a large table, that could at least partially explain your problem.
2) Also, I believe the way the AND/OR logic works means your where clause will work this way:
-- if a row meets the join condition and has a status of 'A', it will come back
-- If a row has an acctstatus of 'ACT' it will come back [regardless of the join - meaing that you have an even worse cross-join when the status is 'ACT'].
So, I suggest using parentheses:
where tblmasterclients.clientname = tbllegaladdr.legalname
and
(
tblmasterclients.acctstatus = 'A'
OR tblmasterclients.acctstatus = 'ACT'
)
Those are two things that jump out at me right away.
---------------------------
Scott Brady
http://www.scottbrady.net/
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

