Ibatis里面用in写SQL语句,问什么报下面的错

StrutsProblemReportStrutshasdetectedanunhandledexception:Messages:Unknowncolumn'?????... Struts Problem Report
Struts has detected an unhandled exception:

Messages: Unknown column '???????? in 'where clause'
--- The error occurred while applying a parameter map. --- Check the statisticsQuery.getProductlineStatistices-InlineParameterMap. --- Check the statement (query failed). --- Cause: java.sql.SQLException: Unknown column '???????? in 'where clause'
我的sql语句是:
SELECT `id`, `productName`, `productNumber`, `callingNumber`,`localCost`, `longCost`, `internationCost`, SUM(`feeTotal`) AS feeTotal, `month` FROM `boss_productline_statistice` WHERE MONTH BETWEEN #beginmonth# AND #endmonth# and productName in ($productName$) GROUP BY productName LIMIT #beginNum#,#endNum#
他一直报Unknown column '???????? in 'where clause'这样的错误
展开
 我来答
曾高远5112
推荐于2016-04-09 · TA获得超过6.2万个赞
知道大有可为答主
回答量:3万
采纳率:0%
帮助的人:3793万
展开全部
ibatis sql in 操作(iterate属性)

1、使用iterate属性,status为数组。

<isNotNull property="status">
<![CDATA[ status in ]]>
<iterate property="status" conjunction="," open="(" close=")">
#status[]#
</iterate>
</isNotNull>

2、使用$,但这种写法存在一定的风险,可能会引起sql注入。

SELECT * FROM test WHERE status in ($status$);
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
bingranyixiao
2012-05-24 · TA获得超过100个赞
知道答主
回答量:88
采纳率:0%
帮助的人:56.7万
展开全部
dao中判断传入数组是否为null,若为null不做操作,反之直接可以在xml中写下列代码:
<select id=“” >
SELECT * FROM test WHERE status in
<iterate open="(" close=")" conjunction=",">#[]#</iterate>
</select>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
来自学府园好奇的桔梗
2011-07-06 · TA获得超过1300个赞
知道小有建树答主
回答量:892
采纳率:0%
帮助的人:729万
展开全部
看字面的意思 是未知的字段 column '???????? in 'where clause'
你的字段是传入的么.. 你把你的sql语句放上来看看
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式