Chris,
I tried what you suggested but I still got 1 record displayed
when there where actually 3 records in Table 2 that matched
the record values in Table 1
e.g
<CFIF Query2.recordcount NEQ 0>
<!--- Display the number of records matched --->
<p>The SEARCH RESULT count is: #query2.RecordCount#. <p>
<!--- Show details of the records mathced --->
#name#<br>
#address#<br>
#email#<br>
</CFIF>
</CFOUTPUT>
Hence even though the screen display the following
The SEARCH RESULT count is: 3.
It only displayed the full details of 1 record???
------Original Message------
From: "Olive, Christopher M Mr NMR" <[EMAIL PROTECTED]>
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
Sent: August 30, 2000 2:20:38 PM GMT
Subject: RE: Query with a Query problem!
by default, if you don't specify a QUERY attribute in the CFOUTPUT, and just
scope the variable with the query name, you'll get the first record.
if you wrap the second CFQUERY in a CFOUTPUT, you'll be good.
eg.
<CFOUTPUT QUERY="Query1">
<CFQUERY NAME="Query2" DATASOURCE="#Search#">
SELECT name,address,email
FROM SearchDetails, UserDetails
WHERE
<CFIF #Query1.name# NEQ "">
SearchDetails.name = '#Query1.name#'
</CFIF>
<CFIF #Query1.address# NEQ "">
AND SearchDetails.address = '#Query1.address#'
</CFIF>
<CFIF #Query1.email# NEQ "">
AND SearchDetails.email = '#Query1.email#'
</CFIF>
</CFQUERY>
<CFIF Query2.recordcount NEQ 0>
#name#<br>
#address#<br>
#email#<br>
</CFIF>
</CFOUTPUT>
Chris Olive,
DOEHRS Website Administrator
-----Original Message-----
From: Adam Smith [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 30, 2000 10:06 AM
To: [EMAIL PROTECTED]
Subject: Query with a Query problem!
Hi people,
I'm new to ColdFusion and I'm already stuck with a query problem!
Basically I have 2 tables, Table 1 contains fields name, address, email
address.
Table 2 has the same fields.
I want to query all the records in Table 2 in one go with the values from
Table 1.
Then I want to output all the records in Table 2 which match the values
from each of the records in Table 1.
Can anyone help please.
Below is what I have at the moment but it only compares record 1 from
Table 1 with the records in Table2, it doesn't go on and compare the
other records in Table1 with the records in Table 2 according
to the CFOUTPUT display.
<cfquery name="Query1" datasource="#Search#">
SELECT *
FROM UserDetails
</cfquery>
<CFQUERY NAME="Query2" DATASOURCE="#Search#">
SELECT name,address,email
FROM SearchDetails, UserDetails
WHERE
<CFIF #Query1.name# NEQ "">
SearchDetails.name = '#Query1.name#'
</CFIF>
<CFIF #Query1.address# NEQ "">
AND SearchDetails.address = '#Query1.address#'
</CFIF>
<CFIF #Query1.email# NEQ "">
AND SearchDetails.email = '#Query1.email#'
</CFIF>
</CFQUERY>
<CFOUTPUT QUERY="Query2">
#name#<br>
#address#<br>
#email#<br>
</CFOUTPUT>
-----------------------------------------------
FREE! The World's Best Email Address @email.com
Reserve your name now at http://www.email.com
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
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.mail-archive.com/[email protected]/
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.
-----------------------------------------------
FREE! The World's Best Email Address @email.com
Reserve your name now at http://www.email.com
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
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.