sure,
i checked the database for one specific person that i know has information
in the equipment table so the info is there..i just cant get it out! :) 
qry one:
<cfquery name="qryAllEmp" datasource="ITData">
        SELECT * FROM tblEmployees
        WHERE   
                tblEmployees.FName LIKE '#fname#%'
                AND tblEmployees.LName LIKE '#lname#%'
                <cfif office eq "All Offices">
                        AND tblEmployees.Office LIKE '%'
                <cfelse>
                        AND tblEmployees.Office LIKE '#office#%'
                </cfif>  
        ORDER BY tblEmployees.lname
</cfquery>
qry two:
<!--- Query to get the users Equipment info. Setting iEquipID eq the
previous
query's results. --->
<cfset iEquipID = qryAllEmp.EmpID>
<cfquery name="qryEquipment" datasource="ITData">
        SELECT * from tblEquipment
        WHERE EquipID = #iEquipID#
</cfquery> 

-----Original Message-----
From: Adkins, Randy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 13, 2001 9:49 AM
To: CF-Talk
Subject: RE: nesting queries


Then it is possible that the 2nd Query returns no records, 

Can you show me both queries


-----Original Message-----
From: Jones, Becky [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 13, 2001 9:45 AM
To: CF-Talk
Subject: RE: nesting queries


i tried that and i only get results from the first query...
<cfoutput>
<cfloop query="qryAllEmp">
        <tr>
                <td colspan="2" bgcolor="FFFFE0"> <b>#qryAllEmp.FName#
#strSpace# #qryAllEmp.MI#                               #StrSpace#
#qryAllEmp.LName#</b>  <br>
                        #qryAllEmp.Dept#
                </td>
        </tr>
        <tr>
                <td colspan="2" bgcolor="FFFFE0"><br></td>
        </tr>
        <tr>
                <td colspan="2" bgcolor="FFFFE0"> 
        
#qryAllEmp.Office#<br>#qryAllEmp.Floor#<br>#qryAllEmp.Phone#
                </td>
        </tr>
        <tr>
                <td colspan="2" bgcolor="FFFFE0"><br> </td>
        </tr>
<!--- Variable to output Label Equipment once. --->
<cfset iEqcnt = 1>
<cfloop query="qryEquipment">
        <tr>
                <td width="10%" bgcolor="FFFFE0">
                        <cfif iEqcnt eq 1><b> Equipment: </b> <cfset
iEqcnt=0> </cfif> 
                </td>   
                <td bgcolor="FFFFE0">#qryEquipment.Description#</td>
        </tr>
</cfloop> 
</cfloop>
</cfoutput>

-----Original Message-----
From: Adkins, Randy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 13, 2001 8:58 AM
To: CF-Talk
Subject: RE: nesting queries


You can place a CFOUTPUT at the very top
of the Queries and instead of using CFOUTPUT QUERY,
use a CFLOOP Query just make sure when you are
outputing the query results you use the prefix
for the given query

Example:

CFOUPUT

CFLOOP QUERY=Query1
        #Query1.MYFIELD#
        CFLOOP Query=Query2
                #Query2.MyField#
                CFLOOP Query=Query3
                #Query3.MyField#
                

Also make sure you close the loops when needed
to reduce the looping through unneeded records.

HTH


-----Original Message-----
From: Jones, Becky [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 13, 2001 8:58 AM
To: CF-Talk
Subject: nesting queries


I have 3 queries.  But when i try to nest the cfoutput tags i get an error
that says this in to allowed.  
how do you use the cfoutput tags to output your information if the data to
your second and third query is dependent upon the info from the first?  
here are my first 2 queries.
<!--- Query to get all User's info. --->
<cfquery name="qryAllEmp" datasource="ITData">
        SELECT * FROM tblEmployees
        WHERE   
        tblEmployees.FName LIKE '#fname#%'
        AND tblEmployees.LName LIKE '#lname#%'
        <cfif office eq "All Offices">
                AND tblEmployees.Office LIKE '%'
        <cfelse>
                AND tblEmployees.Office LIKE '#office#%'
        </cfif>  
        ORDER BY tblEmployees.lname
</cfquery>
<!--- Query to get the users Equipment info. Setting iEquipID eq the
previous query's results. --->
<cfset iEquipID = qryAllEmp.EmpID>
<cfquery name="qryEquipment" datasource="ITData">
        SELECT * from tblEquipment
        WHERE EquipID = #iEquipID#
</cfquery> 
I want to be able to have one table that i can put the information all
together.  any ideas?


*************************************************
This e-mail, including any attachments, is intended for the 
receipt and use by the intended addressee(s), and may contain 
confidential and privileged information.  If you are not an intended 
recipient of this e-mail, you are hereby notified that any unauthorized 
use or distribution of this e-mail is strictly prohibited.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to