I would guess that every row from tblbillingaddr is being returned for
each row of tblmastercleints = tblelegaladdr.

You need to add a where to link tblbillingaddr to something from one of
the other tables.

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



-----Original Message-----
From: hammerin hankster [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 06, 2004 9:51 AM
To: CF-Talk
Subject: Need Serious Help - query broken

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