【发布时间】:2016-11-08 08:48:29
【问题描述】:
我有一个这样的 SQL 查询:
"select f.filterid as filtename, f.id as filtertext " +
"from filter f " +
"where group_Id = '" + id +"' " +
"OR groupIds like '%." + id + ".%' ";
我想将一个 id 列表传递给该查询以提高性能。我不知道 REGEX 是否适用于 IN 子句。我尝试了下面的一个,它不起作用,不知道在 REGEX 的情况下使用什么。
"select f.filterid as filtename, f.id as filtertext from filter f " +
"where group_Id in ("+StringUtils.join(ids, "','")+")" +
"OR groupIds in ("+StringUtils.join(ids, "','")+")"";
谢谢。
【问题讨论】:
-
group_Id 是 varchar 数据类型的数值数据类型?
-
group_Id 是 int 而 groupIds 是 varchar