Cheers... worked nicely thanks!

_________________
david crowther
web developer
sitd.com

t 0044 1753 865 731
f 0044 1753 865 785




-----Original Message-----
From: Dave Hannum [mailto:[EMAIL PROTECTED]]
Sent: 05 May 2000 14:25
To: [EMAIL PROTECTED]
Subject: Re: Multiple search results


Try using the DISTINCT attribute in your search.

<cfquery name="newsSearch" datasource="#database#" dbtype="ODBC">
SELECT DISTINCT fieldname
FROM tblNews
WHERE StartDate LIKE '%#trim(form.search1)#%'
OR NewsHeader LIKE '%#trim(form.search1)#%'
OR NewsBody LIKE '%#trim(form.search1)#%'
ORDER BY StartDate DESC
</cfquery>


OR


Put the letter field name you are getting dupes in as the FIRST field in
your ORDER BY
the in your output do a GROUP attribute.
<CFOUTPUT QUERY="newsSearch" GROUP="fieldname">
    <CFOUTPUT>
            #stuffage#
    </CFOUTPUT>
</CFOUTPUT>

Dave


=================================
"Always Drink Upstream From The Herd!"

David Hannum
Web Analyst/Programmer
Ohio University
[EMAIL PROTECTED]
(740) 597-2524



----- Original Message -----
From: David Crowther <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 05, 2000 7:05 AM
Subject: Multiple search results


Hello CF people...

My search results display more than 1 result of each record found. For
example, if I search for the letter C, the same record will be displayed
twice because the field searched will have the letter C twice in that field.
Can this be fixed/corrected?

My code used on the action page as follows:

***************************
<cfquery name="newsSearch" datasource="#database#" dbtype="ODBC">
SELECT *
FROM tblNews
WHERE StartDate LIKE '%#trim(form.search1)#%'
OR NewsHeader LIKE '%#trim(form.search1)#%'
OR NewsBody LIKE '%#trim(form.search1)#%'
ORDER BY StartDate DESC
</cfquery>
**************************

Thank you for your help...

_________________
david crowther
web developer
sitd.com

t 0044 1753 865 731
f 0044 1753 865 785

----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to
[EMAIL PROTECTED] with 'unsubscribe' in the body.

----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to