【发布时间】:2015-09-08 01:18:46
【问题描述】:
我从 ArrayList 的表中收集了不同的 Item 值。现在我想将 ArrayList 的每个值迭代为列值。
PreparedStatement pstmt =conn.preparedStatement("select distinct(A.ID) from Products A,Products B where A.ID=B.ID and A.Item in (?)");
以上必须在循环下,ArrayList中的每个元素都被用作每次迭代的列值。
【问题讨论】:
-
你能更清楚一点吗 - 你从 ArrayList 中的 DB(使用你提到的查询)中获取了不同的值。正确的?现在您希望数组中的每个元素都用于其他查询吗?
-
显示您尝试过的内容。
-
@SandeepJindal 你为什么要减少我的观点?
-
@SrividhyaShama 我没有。我相信 cmets 比 downvote 更有意义。
标签: java mysql arraylist prepared-statement