0

I keep getting errors on this line of code:

pstmt = conn.prepareStatement( "SELECT * FROM products WHERE category IN" +
"(" + "SELECT catid FROM category WHERE name= currentcat " + ")" );

I'm guessing the problem is my parentheses. If it's not then what's wrong with my code? Thank you!

4

1 回答 1

1

它与括号无关。在 SQL 中,varchar 值必须用单引号括起来:

SELECT catid FROM category WHERE name = 'currentcat'

您未发布的错误消息通常包含有意义的信息。始终阅读(并发布)完整且准确的错误消息。

于 2013-05-12T08:20:02.610 回答