At 06:24 PM 4/2/00 -0700, you wrote:
><cfquery name = "SEARCH_EMP_DEPT" datasource="MYTEST" dbtype="ODBC">
>                                 SELECT *
>                                 FROM y where #emp_id# LIKE 
> '#search_criteria#%'
>                                 </cfquery>

Assuming that table Y is related to X through the foreign key emp_ID you 
could do this:

<cfquery name = "SEARCH_EMP_DEPT" datasource="MYTEST" dbtype="ODBC">
SELECT *
FROM y where emp_id LIKE '#SEARCH_QUERY.search_criteria#%'
</cfquery>


or, even better, join the two tables into one query like this:

SELECT Y.* FROM Y, X
WHERE Y.emp_ID = X_EMP_ID
AND X.emp_name LIKE '#search_criteria#%'

Bruce


------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
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.

Reply via email to