susanwayne 发表于 2018-5-23 11:29:47

SQL语句中怎么拼接 in 条件

AND rwc.item_code in (
<#assign x >
        <#list itemCodes as itemCode>
             ${itemCode}
             <#if itemCode_has_next>,</#if>
        </#list>
</#assign>
${x}
)

这样出来的数据为 AND rwc.item_code in ('a,b'),查询不出数据
如果修改为’${itemCode}' 之后 AND rwc.item_code in ('’a‘,’b‘'),请问怎么去掉最外面的'' 单引号呀!

susanwayne 发表于 2018-5-23 13:31:58

不好意思,是我传参时添加了单引号,
AND rwc.item_code IN (
<#list itemCodes as itemCode>
        '${itemCode}'
        <#if itemCode_has_next>,</#if>
</#list>
)
页: [1]
查看完整版本: SQL语句中怎么拼接 in 条件