Hi all
I need to run a select statement based on the results of another select statement.
this is what I have:
<cfquery name="get_planid" datasource="#Application.dsn#">
SELECT plan_id
FROM VAR6000_partner_PLAN
where
partner_name = 'test'
</cfquery>
this will return:
plan_id
3
10
22
Now, I need to run another statement based on the above plan_ids, 3, 10 and 22.
Like so:
<cfquery name="get_Main_Group" datasource="#Application.dsn#">
SELECT DISTINCT PRODUCT_NAME
FROM VAR6000_PLAN
where plan_id = '#get_planid.plan_id#'
</cfquery>
The only thing is the second query is only running against '3' and not 3, 10 and 22.
I know I need to do some kind of loop but I cant seem to figure it out.
Please help!
I need to run a select statement based on the results of another select statement.
this is what I have:
<cfquery name="get_planid" datasource="#Application.dsn#">
SELECT plan_id
FROM VAR6000_partner_PLAN
where
partner_name = 'test'
</cfquery>
this will return:
plan_id
3
10
22
Now, I need to run another statement based on the above plan_ids, 3, 10 and 22.
Like so:
<cfquery name="get_Main_Group" datasource="#Application.dsn#">
SELECT DISTINCT PRODUCT_NAME
FROM VAR6000_PLAN
where plan_id = '#get_planid.plan_id#'
</cfquery>
The only thing is the second query is only running against '3' and not 3, 10 and 22.
I know I need to do some kind of loop but I cant seem to figure it out.
Please help!