<cfquery name="" datasource=""> SELECT s.staffTitle, s.staffFirstName, s.staffLastName FROM STAFF s, STUDENTS p WHERE s.staffEmail = p.staffEmail AND p.studentEmail = <cfqueryparam value="[EMAIL PROTECTED]" cfsqltype="cf_sql_varchar"> </cfquery>
Above is how I would write the query, but I am still learning..... hth... Charles Hanlon Web Applications Developer Food Service Enablers, Inc. www.fsenablers.com The People. The Platform. The Products. Make the Difference ----- Original Message ----- From: "Richard White" <[EMAIL PROTECTED]> To: "CF-Talk" <[email protected]> Sent: Wednesday, October 25, 2006 9:32 AM Subject: nested queries > hi, i am having problems working out how to execute a nested query in a > cfquery. > > It works fine in mysql with the following sql statement: > > SELECT staffTitle,staffFirstName,staffLastName FROM STAFF WHERE staffEmail > = (SELECT staffEmail FROM STUDENTS WHERE studentEmail = email); > > however, i am not sure how to convert this into a cfquery. i have tried > the following but getting an error: > > SELECT staffTitle, staffFirstName, staffLastName FROM STAFF WHERE > staffEmail = SELECT staffEmail FROM STUDENTS WHERE studentEmail = > <cfqueryparam value="[EMAIL PROTECTED]" cfsqltype="cf_sql_varchar"> > > i would appreciate some help on what i am doing wrong > > thanks very much > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:257985 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

