> Hi everyone.  I am trying to loop over the results of a query,
> and match the
> names from that query with the names from another query.  Here's what it
> look like:
>
> <cfloop query="qcfGetContactNames">
>
>       <cfif qcfGetOldContactInfo.mainContactName is
> qcfGetContactNames.FullName>
>       <cfoutput>
>       <table>
>               <tr>
>                       <td>#qcfGetContactNames.FullName# #mainContactTitle#
> #mainContactEmail#</td>
>               </tr>
>
>       </table>
>       </cfoutput>
>       </cfif>
>
>
> </cfloop>
>
> The two queries look like this:
> <cfquery name="qcfGetContactNames" datasource="FSLibrary_Dev">
>       SELECT          EventContactFirstName+'
> '+EventContactLastName as FullName
>       FROM            dbo.tbl_EP_EventContacts
>       ORDER BY        EventContactFirstName Asc
> </cfquery>
>
> <cfquery name="qcfGetOldContactInfo" datasource="FSLibrary_Dev">
>       SELECT          mainContactName, mainContactTitle,
> mainContactAreaCode,
> mainContactPhone, mainContactFaxAreaCode, mainContactFax, mainContactEmail
>       FROM            dbo.tblIndustryEvents
>       ORDER BY        mainContactName Asc
> </cfquery>
>
> I keep getting no records matching, but I know that the names
> match, because
> the names from the first query where pulled from the database in
> the second
> query, separated, and added.  So the names are exactly the same.
> Any ideas?

Can I ask you why you're not doing this in SQL? It'll do it a lot quicker
than you can in CF...

In it's simplest terms...

<cfquery name="qcfGetContactNames" datasource="FSLibrary_Dev">
        SELECT t2.mainContactName, t2.mainContactTitle, t2.mainContactAreaCode,
t2.mainContactPhone, t2.mainContactFaxAreaCode, t2.mainContactFax,
t2.mainContactEmail
        FROM dbo.tblIndustryEvents as t2, dbo.tbl_EP_EventContacts as t1
        WHERE t1.EventContactFirstName+'
'+t1.EventContactLastName=t2.mainContactName
        ORDER BY t2.mainContactName
</cfquery>

This query will give you all entries in "tblIndustryEvents" that are also in
"tbl_EP_EventContacts" - if you want entries that AREN'T in both tables,
then it'll be different SQL...

HTH

Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************


> -----Original Message-----
> From: Chris Martin [mailto:[EMAIL PROTECTED]]
> Sent: 27 November 2000 17:25
> To: CF-Talk
> Subject: String matching while looping over a query
>
>
>
> Thanks in advance,
>
> Chris Martin
> www.fsenablers.com
> www.fslink.com
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Structure your ColdFusion code with Fusebox. Get the official
> book at http://www.fusionauthority.com/bkinfo.cfm
>
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
>
>

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

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to