What part is being duplicated? The URL? All of the records?
If it is all the records then you should have a look at your 
Database. Unless duplication is okay in your DB.

What is the ID field? Is it an auto generated ID or an ID
Field you are populating?


 

-----Original Message-----
From: Mark Henderson [mailto:[EMAIL PROTECTED] 
Sent: Sunday, September 11, 2005 10:44 PM
To: CF-Talk
Subject: Small Problem with Query Duplicates

I have a query thats run from a user search request, that looks like so:

<cfquery name="searchFarmLinks" dataSource="#request.dsn#">
     SELECT             URL, ID, Company, Category, Phone, Email,
Paid_listing
     FROM               nzfarming
        WHERE           URL IS NOT NULL
     AND                        uCase(Company) like
                                <cfqueryparam value =
"%#uCase(searchtext)#%" 
cfsqltype="cf_sql_varchar" />
     ORDER BY   Paid_listing ASC, Company ASC;
</cfquery>

This is fine and works.  However, the url is listed (in the output for
display) each time an instance of the search term is matched (obviously) and
I would like to get rid of the duplicates. I tried using DISTINCT without
success i.e in the query,  SELECT UNIQUE URL, Company etc

If I do a single QoQ, like so
<cfquery name="searchDistinctFarmLinks" dbtype="query">
        SELECT          DISTINCT URL
        FROM            searchFarmLinks
</cfquery>
it DOES appear to return the correct recordset but I'm stumped as to how to
re query based on that result. I also figure there must be a quicker cleaner
way to do this. Any ideas?? All help appreciated.

TIA
regards
Mark



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217916
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to