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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217906
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