Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Output Duplicating

Status
Not open for further replies.

monoone

Programmer
May 24, 2002
219
0
0
US
I have an output that is duplicating by 2.

So if I have one record it shows 2.

I have verified that there is one record created not 2 in the access DB.

Here is the query:

<CFQUERY NAME="GetContacts" DBTYPE="ODBC" DATASOURCE="#request.datasource#">

SELECT ContactType.*, Contact.*

FROM Contact, ContactType

WHERE
ContactType.ContactType = 'Web Sign-Up' AND
Contact.AccountID = #session.AccountID#

</CFQUERY>

Here is the output:

<TABLE CELLSPACING="2" CELLPADDING="2" BORDER="0" WIDTH="300">
<CFOUTPUT QUERY="GetContacts">
<TR>
<TD VALIGN="middle">#FirstName# #LastName#</TD>
</TR>
</TR>
</CFOUTPUT>

</TABLE>

How do I fix this???

Thanks,

Monoone
 
Late answer on this one but the reason you're getting that is that your where statement does not relate the two tables.. so its like your saying

SELECT ContactType.*, Contact.*

FROM Contact, ContactType

WHERE
ContactType.ContactType = 'Web Sign-Up' AND
Contact.AccountID = #session.AccountID#

Code:
SELECT ContactType.*
  FROM ContactType
 where ContactType = 'Web Sign-Up'

&

SELECT Contact.*
  FROM Contact
 WHERE AccountID = #session.accountID#

in the same query... Do you have a field in both tables that matches for the relation?

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top