This may not be related to your problem, but may I suggest writing your
query this way:

<cfquery name="qFoo" datasource="#application.ds#">
    SELECT name, product_id
    FROM    tblProducts
    WHERE    category_id in '0000,#attributes.theList#'
</cfquery>

Much cleaner, and from what I understand it's faster than writing a bunch of
seperate "or" statements.

I couldn't say why your getting more records then your expecting without
seeing the id's in the database and the list your comparing them to in the
"or" statement.

Rick
-----Original Message-----
From: Greg Wolfinger [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 04, 2000 3:55 PM
To: CF-Talk
Subject: getting only unique query results


Hey Guys:

I have a query that looks likes this:

<cfquery name="qFoo" datasource="#application.ds#">
    SELECT name, product_id
    FROM    tblProducts
    WHERE    category_id = '0000'
    <cfloop list="#attributes.theList#" delimiters="," index="theID">
        OR category_id = '#theID#'
    </cfloop>
</cfquery>

The problem is that it keeps on selecting the products over and over and not
just once.  I have only 11 records for it to try and select, but it comes
back to give me 484.  Anyone know why this is happenening???

Thanks,



Greg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to