I have had weird things happing with queies with in a query loop

try putting the outer query column into it's own variable and use that in
the inner query

<cfset VARIABLES.serialnumber = Trim(get.serialnumber) />
....
where serialnumber = '#VARIABLES.serialnumber#'

On Thu, Apr 10, 2008 at 9:36 PM, Orlini, Robert <[EMAIL PROTECTED]>
wrote:

> I have a simple loop problem. I'm comapring two tables and want it to
> display serial numbers from both tables when there is a match. Unfotunately
> the way I have it setup it never finds a match even though I know there is a
> few. I think the loop is wrong. See code below.
>
> Thanks.
>
> RO
> HWW
>
> <CFQUERY name="get" datasource="pc_inventory">
> Select * from inventory
> where serialnumber = serialnumber
> </cfquery>
>
> <CFloop query="get">
> <CFQUERY name="check" datasource="spice">
> Select * from spice
> where serialnumber = '#trim(get.serialnumber)#'
> </cfquery>
>
> <CFIF get.recordcount eq 1>
> <CFoutput>#trim(check.serialnumber)# --
> #trim(get.serialnumber)#<br></CFOUTPUT>
> <cfelse>NO MATCH - <cfoutput>#get.recordcount#</cfoutput><br>
> </CFIF>
> </cfloop>
> </html>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:303094
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to