database loops on query?
a field in one table inidcates which rows in it and 2 related tables should be accessed in a query.
all 3 tables share a field: pgID. it is the primary key in the first table and a field in the other 2.
the first query finds which rows relate by a variable: pgfeat
<cfquery name="gtpgsfeat" datasource="mydb">
SELECT pgID
FROM pages
WHERE pgfeat = 1
</cfquery>
i then loop through the query to create a list of all rows that are returned from the query
<cfoutput>
<cfloop query="gtpgsfeat">
<cfif ISDefined('catz')>
<cfset catz = "#catz#, #gtpgsfeat.pgID#">
<cfelse>
<cfset catz = "#gtpgsfeat.pgID#">
</cfif>
</cfloop>
</cfoutput>
i then apply this to a query for the related tables
<cfquery name="gtpgsfeat1" datasource="mydb" dbtype="ODBC">
SELECT pages.*, pg_cont.*, pg_text.*
FROM pages, pg_cont, pg_text
WHERE (pages.pgID IN (#catz#)) AND (pg_cont.pgID IN (#catz#)) AND (pg_text.pgID IN (#catz#)) ;
</cfquery>
the problem. the second query loops within itself - times the recordcount of first query - and i get the same data times the recordcount of the first query.
with a recordcount of 3 for the first query, i get a recordcout of 27 (3 X 3 X 3) for the second query...
example:
abe
cathy
john
abe
cathy
john
abe
cathy
john
? what am i missing here
tnx in advance
