我有两张桌子:DPCWEB_PRODUCT和DETSVIEW_NAME。我想从DETSVIEW_NAME中选择PARENT_SPR_ID,但我需要从DPCWEB_PRODUCT中选择DETSVIEW_NAME名称。现在我这样做:
<cfquery DataSource="#REQUEST.DSN#" name="DETSVIEW_SEARCH">
Select
DETSVIEW_NAME
From
DPCWEB_PRODUCT
Where
PRODUCT_NAME = '#SESSION.SELECTED_PRODUCT_NAME#'
</cfquery>
<CFQUERY DataSource="#REQUEST.DSN#" Name="SPR_PARENT">
SELECT
PARENT_SPR_ID
FROM
#DETSVIEW_SEARCH.DETSVIEW_NAME#
WHERE SPR_ID = #COMPLETION_FORM_SPRS.SPR_ID#
</cfquery>
<cfoutput>#SPR_PARENT.PARENT_SPR_ID#</cfoutput>
有更有效的方法吗?