SQl 错误:在关键字 'AND' 附近有语法错误。
Stringsql="SELECTMAX(t)ASF83maxFROM(SELECTSUM(F83)AStFROMFjGfbDataWHERE((Dev_id=22)OR...
String sql = "SELECT MAX(t) AS F83max FROM (SELECT SUM(F83) AS t FROM FjGfbData WHERE ((Dev_id = 22) OR (Dev_id = 23) OR (Dev_id = 24) OR (Dev_id = 25) OR (Dev_id = 26))) AND (FG_date = '"
+statDate+"')"; 展开
+statDate+"')"; 展开
4个回答
展开全部
String sql = "SELECT MAX(t) AS F83max FROM (SELECT SUM(F83) AS t FROM FjGfbData WHERE ((Dev_id = 22) OR (Dev_id = 23) OR (Dev_id = 24) OR (Dev_id = 25) OR (Dev_id = 26)) AND (FG_date = '"
+statDate+"'))";
如上,AND前面多 了个右括号,应该放到最后
+statDate+"'))";
如上,AND前面多 了个右括号,应该放到最后
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
写的好麻烦:直接这样:"String sql=SELECT MAX(t) AS F83max FROM (SELECT SUM(F83) AS t FROM FjGfbData WHERE Devid in('22','23','24','25','26') AND FG_date = '"+statDate+"')";
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
"AND " 改成 “WHERE”
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询