私がしたことをするための最良の方法は何ですか?<cfquery>
queryExecute
cfquery
<cfquery name="qry">
SELECT * FROM tbl_products
WHERE filed1 = 1
<cfif structKeyExists(URL, "test")>
AND filed2 = 2
</cfif>
ORDER BY id DESC
</cfquery>
cfexecute
<cfscript>
sql = "
SELECT * FROM tbl_products
WHERE filed1 = 1
ORDER BY id DESC
";
if (structKeyExists(URL, "test")){
sql = "
SELECT * FROM tbl_products
WHERE filed1 = 1
AND filed2 = 2
ORDER BY id DESC
";
}
qry = queryExecute(
sql = sql
);
</cfscript>
私は自分自身をうまく説明できたと思います...