That's a distinct on an awful lot of fields!

You realize that a distinct causes every record in every table
(referenced in the query) to be examined, and the specified fields
compared to assure uniqueness.

This can easily bring a db server to its knees.

What db server are you using?

Can you simplify the query, perhaps a simple distinct query, followed
by another query based on the unique IDs retrieved in the first?

HTH

Dick

On Jul 6, 2004, at 7:50 AM, hammerin hankster wrote:

> I've got the following query that hangs the MX ODBC service (at least
> I attempt to stop it after 20 minutes).
>
>  <CFQUERY NAME="readesi" DATASOURCE="esidb1">
>  SELECT DISTINCT tblmasterclients.ClientName, AliasName, AlphaPrefix,
> SiteID, Infinity, AuthCode, POBox, POBoxCombo,
> tblmasterclients.Comments, DID,
>  SVCType, tblmasterclients.AcctStatus, PreparedDate, URL,
> TerminationReason, TerminationDesc, billingaddr, billingaddr2,
> billingstate, billingcity,
>  billingzip, billingcontact, billingemail, billingphone, billingext,
> billingfaxnumber, billingcellnumber, legalname
>
>  FROM��tblMasterClients, tblbillingaddr, tbllegaladdr
>
>  where�����tblmasterclients.clientname = tbllegaladdr.legalname
>
>  and���tblmasterclients.acctstatus = 'A'
>  OR������tblmasterclients.acctstatus = 'ACT'
>
>  ORDER BY tblmasterclients.clientname
>
>  The query seems simple enough but what's not obvious is the
> relationships between some of the tables.��If I posted a screen cap of
> the relationship, any chance I could get some help?
>
>  Thanks!
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to