ColdFusionで情報を抽出するデータベースクエリを作成しました。関連するデータを取得するためにWHERE句に値を渡す方法を知りたいと思います。これは私のコードサンプルです。誰でも助けてくれる?ColdFusionデータベースクエリにパラメータ値を渡す方法
<cfquery name="FILM_STRIP_QUERY" datasource="#dsn#">
select distinct tm.id as teachingmoduleid,
(select concat(prs.first_name, ' ',prs.last_name) AS Video_presenter from presentations pss
inner join topics tpcs on tpcs.id = pss.topic_id
inner join presenters prs on prs.id = pss.presenter_id
where pss.name = ps.name
and tpcs.title = tp.title
) AS video_presenter,
(select pss.43_png from presentations pss
inner join topics tpcs on tpcs.id = pss.topic_id
inner join presenters prs on prs.id = pss.presenter_id
where pss.name = ps.name
and tpcs.title = tp.title) AS png_name
from teaching_modules tm
inner join tm_segments sg on sg.module_id = tm.id
inner join topics tp on tp.id = sg.topic_id
inner join presenters prs on prs.id = tm.presenter_id
left outer join presentations ps on ps.id = sg.presentation_id
where tm.id =
</cfquery>
、これは呼び出し元の関数
<cfloop = "FILM_STRIP_QUERY">
<!--- this is where I wanna pass the parameter--->
</cfloop>
FARM_STRIP_QUERYの範囲をVARに忘れないでください。このコードはそのままでは動作しません。 –
duncan
良い点、更新された投稿 – jamesTheProgrammer