<cfquery name="qry1" datasource="#Application.DSN#">
select * from users where id IN (<cfqueryparam cfsqltype="cf_sql_integer" value="1,2" list="yes">)
</cfquery>
<cfdump var="#qry1#">
<cfscript>
query name="qry2" datasource="#Application.DSN#" {
writeoutput("select * from users where id IN (");
queryparam cfsqltype="cf_sql_integer" value="1,2" list="yes";
writeoutput(")");
}
dump(qry2);
</cfscript>
<cfscript>
qry3 = new Query();
qry3.setDatasource(Application.DSN);
qry3.addParam(name="ids",value="1,2",cfsqltype="cf_sql_integer", list="yes");
qry3.setSql("select * from users where id IN (:ids)");
dump(qry3.execute().getResult());
</cfscript>
Hello,Here are a couple that work in cfscript with IN. I couldn't get the queryExecute to work with "list"
numbers = queryNew("id,en,mi", "integer,varchar,varchar", [
[1,"one", "tahi"],
[2,"two", "rua"],
[3,"three", "toru"],
[4,"four", "wha"]
]);
evens = queryExecute(
"SELECT * FROM numbers WHERE id IN (?)",
[{value="2,4", list=true, cfsqltype="CF_SQL_INTEGER"}],
{dbtype="query", numbers=numbers}
);
writedump(evens);
evens = queryExecute(
"SELECT * FROM numbers WHERE id IN (:evens)",
{evens={value="2,4", list=true, cfsqltype="CF_SQL_INTEGER"}},
{dbtype="query", numbers=numbers}
);
evens = new Query(
sql = "SELECT * FROM numbers WHERE id IN (?)",
parameters = [{value="2,4", list=true, cfsqltype="CF_SQL_INTEGER"}],
dbtype = "query",
numbers = numbers
).execute().getResult();
evens = new Query(
sql = "SELECT * FROM numbers WHERE id IN (:evens)",
parameters = [{name="evens",value="2,4", list=true, cfsqltype="CF_SQL_INTEGER"}],
dbtype = "query",
numbers = numbers
).execute().getResult();
--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/bafcac12-3aaf-401f-915c-85799c548343%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/CAPURtC1BUwSSLj57estSHAK5g28kTd-D2m29how2aVoQXB253w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
-- Igal Sapir Railo Core Developer http://getRailo.org/
try putting space in side bracketsand psportid in ( :psportid )