-2
rs = stmt.executeQuery("select c1.itemname,c1.itemcalorie,p.restname,p.location from categorie1 c1 ,Place p
where p.pincode = '" + pincode1 + "' and c1.itemid IN
("select c1.itemid from categorie1 c1 where c1.itemcalorie <='" + cal1 + "' and c1.itemcalorie >='" + cal1-400 + "' and c1.restid = p.restid ") ");
请努力改进问题的内容和格式。提供一些细节并解释你所尝试过的。不这样做将不可避免地导致你的问题被忽略和/或关闭。如果您不确定,请参阅https://stackoverflow.com/help/how-to-ask。 – 2014-12-11 03:39:53
你的'IN'子句引入了额外的引号,但是没有看到你收到的实际错误,这太难说了。 – 2014-12-11 03:41:30
如果你先组装你的查询(不知何故),比如'query =“,请从categorie1 c1选择c1.itemname,c1.itemcalorie,p.restname,p.location,放置p.pincode ='”+ pincode1 +''和c1.itemid IN (“select c1.itemid from categorie1 c1 where c1.itemcalorie <='”+ cal1 +“'and c1.itemcalorie> ='”+ cal1-400 +“'and c1.restid = p.restid “)”;'然后运行它'rs = stmt.executeQuery(query);',你可以在输出你的查询并检查它是否合法... – Abecee 2014-12-11 04:04:31